This repository was archived by the owner on Feb 23, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +18
-3
lines changed Expand file tree Collapse file tree 3 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -160,6 +160,7 @@ class ChannelAction {
160160 limboBalance : pfcc . limboBalance ,
161161 maturityHeight : pfcc . maturityHeight ,
162162 blocksTilMaturity : pfcc . blocksTilMaturity ,
163+ timeTilAvailable : this . _formatTimeTilMaturity ( pfcc . blocksTilMaturity ) ,
163164 status : 'pending-force-closing' ,
164165 } ) ) ;
165166 const wccs = response . waitingCloseChannels . map ( wcc => ( {
@@ -346,6 +347,12 @@ class ChannelAction {
346347 const channel = pc . find ( c => c . channelPoint === channelPoint ) ;
347348 if ( channel ) pc . splice ( pc . indexOf ( channel ) ) ;
348349 }
350+
351+ _formatTimeTilMaturity ( numBlocks ) {
352+ const days = Math . floor ( numBlocks / ( 24 * 6 ) ) ;
353+ const hours = Math . floor ( ( numBlocks % ( 24 * 6 ) ) / 6 ) ;
354+ return `${ days } days and ${ hours } hours` ;
355+ }
349356}
350357
351358export default ChannelAction ;
Original file line number Diff line number Diff line change @@ -43,8 +43,8 @@ const ChannelDetailView = ({ store, nav }) => (
4343 </ DetailField >
4444 ) : null }
4545 { store . selectedChannel . blocksTilMaturity ? (
46- < DetailField name = "Blocks Until Maturity " >
47- { store . selectedChannel . blocksTilMaturity }
46+ < DetailField name = "Time Til Available " >
47+ { store . selectedChannel . timeTilAvailable }
4848 </ DetailField >
4949 ) : null }
5050 < DetailField name = "Remote Node Public Key" >
Original file line number Diff line number Diff line change @@ -146,7 +146,12 @@ describe('Action Channels Unit Tests', () => {
146146 grpc . sendCommand . withArgs ( 'pendingChannels' ) . resolves ( {
147147 pendingOpenChannels : [ { channel : { ...pendingChannel } } ] ,
148148 pendingClosingChannels : [ { channel : { ...pendingChannel } } ] ,
149- pendingForceClosingChannels : [ { channel : { ...pendingChannel } } ] ,
149+ pendingForceClosingChannels : [
150+ {
151+ channel : { ...pendingChannel } ,
152+ blocksTilMaturity : 463 ,
153+ } ,
154+ ] ,
150155 waitingCloseChannels : [ { channel : { ...pendingChannel } } ] ,
151156 totalLimboBalance : 1 ,
152157 } ) ;
@@ -156,6 +161,9 @@ describe('Action Channels Unit Tests', () => {
156161 remotePubkey : 'some-key' ,
157162 fundingTxId : 'FFFF' ,
158163 } ) ;
164+ expect ( store . pendingChannels [ 2 ] , 'to satisfy' , {
165+ timeTilAvailable : '3 days and 5 hours' ,
166+ } ) ;
159167 } ) ;
160168
161169 it ( 'should log error on failure' , async ( ) => {
You can’t perform that action at this time.
0 commit comments