@@ -176,7 +176,7 @@ abstract class ChannelIntegrationSpec extends IntegrationSpec {
176
176
sender.send(nodes(" C" ).register, Register .Forward (sender.ref, htlc.channelId, CMD_FORCECLOSE (sender.ref)))
177
177
sender.expectMsgType[RES_SUCCESS [CMD_FORCECLOSE ]]
178
178
// we then wait for F to detect the unilateral close and go to CLOSING state
179
- awaitCond(stateListenerF.expectMsgType[ChannelStateChanged ].currentState == CLOSING , max = 60 seconds)
179
+ awaitCond(stateListenerF.expectMsgType[ChannelStateChanged ](max = 60 seconds) .currentState == CLOSING , max = 60 seconds)
180
180
// we generate a few blocks to get the commit tx confirmed
181
181
generateBlocks(3 , Some (minerAddress))
182
182
// we then fulfill the htlc, which will make F redeem it on-chain
@@ -196,8 +196,8 @@ abstract class ChannelIntegrationSpec extends IntegrationSpec {
196
196
// we generate blocks to make txs confirm
197
197
generateBlocks(2 , Some (minerAddress))
198
198
// and we wait for the channel to close
199
- awaitCond(stateListenerC.expectMsgType[ChannelStateChanged ].currentState == CLOSED , max = 60 seconds)
200
- awaitCond(stateListenerF.expectMsgType[ChannelStateChanged ].currentState == CLOSED , max = 60 seconds)
199
+ awaitCond(stateListenerC.expectMsgType[ChannelStateChanged ](max = 60 seconds) .currentState == CLOSED , max = 60 seconds)
200
+ awaitCond(stateListenerF.expectMsgType[ChannelStateChanged ](max = 60 seconds) .currentState == CLOSED , max = 60 seconds)
201
201
awaitAnnouncements(1 )
202
202
}
203
203
@@ -212,8 +212,8 @@ abstract class ChannelIntegrationSpec extends IntegrationSpec {
212
212
// then we have F unilaterally close the channel
213
213
sender.send(nodes(" F" ).register, Register .Forward (sender.ref, htlc.channelId, CMD_FORCECLOSE (sender.ref)))
214
214
sender.expectMsgType[RES_SUCCESS [CMD_FORCECLOSE ]]
215
- awaitCond(stateListenerC.expectMsgType[ChannelStateChanged ].currentState == CLOSING , max = 60 seconds)
216
- awaitCond(stateListenerF.expectMsgType[ChannelStateChanged ].currentState == CLOSING , max = 60 seconds)
215
+ awaitCond(stateListenerC.expectMsgType[ChannelStateChanged ](max = 60 seconds) .currentState == CLOSING , max = 60 seconds)
216
+ awaitCond(stateListenerF.expectMsgType[ChannelStateChanged ](max = 60 seconds) .currentState == CLOSING , max = 60 seconds)
217
217
// we generate a few blocks to get the commit tx confirmed
218
218
generateBlocks(3 , Some (minerAddress))
219
219
// we then fulfill the htlc (it won't be sent to C, and will be used to pull funds on-chain)
@@ -233,8 +233,8 @@ abstract class ChannelIntegrationSpec extends IntegrationSpec {
233
233
// we generate blocks to make txs confirm
234
234
generateBlocks(2 , Some (minerAddress))
235
235
// and we wait for the channel to close
236
- awaitCond(stateListenerC.expectMsgType[ChannelStateChanged ].currentState == CLOSED , max = 60 seconds)
237
- awaitCond(stateListenerF.expectMsgType[ChannelStateChanged ].currentState == CLOSED , max = 60 seconds)
236
+ awaitCond(stateListenerC.expectMsgType[ChannelStateChanged ](max = 60 seconds) .currentState == CLOSED , max = 60 seconds)
237
+ awaitCond(stateListenerF.expectMsgType[ChannelStateChanged ](max = 60 seconds) .currentState == CLOSED , max = 60 seconds)
238
238
awaitAnnouncements(1 )
239
239
}
240
240
@@ -250,8 +250,8 @@ abstract class ChannelIntegrationSpec extends IntegrationSpec {
250
250
disconnectCF(htlc.channelId, sender)
251
251
// we generate enough blocks to reach the htlc timeout
252
252
generateBlocks((htlc.cltvExpiry.toLong - getBlockCount).toInt, Some (minerAddress))
253
- awaitCond(stateListenerC.expectMsgType[ChannelStateChanged ].currentState == CLOSING , max = 60 seconds)
254
- awaitCond(stateListenerF.expectMsgType[ChannelStateChanged ].currentState == CLOSING , max = 60 seconds)
253
+ awaitCond(stateListenerC.expectMsgType[ChannelStateChanged ](max = 60 seconds) .currentState == CLOSING , max = 60 seconds)
254
+ awaitCond(stateListenerF.expectMsgType[ChannelStateChanged ](max = 60 seconds) .currentState == CLOSING , max = 60 seconds)
255
255
sender.send(nodes(" C" ).register, Register .Forward (sender.ref, htlc.channelId, CMD_GETSTATEDATA (ActorRef .noSender)))
256
256
val Some (localCommit) = sender.expectMsgType[RES_GETSTATEDATA [DATA_CLOSING ]].data.localCommitPublished
257
257
// we wait until the commit tx has been broadcast
@@ -282,8 +282,8 @@ abstract class ChannelIntegrationSpec extends IntegrationSpec {
282
282
// we generate blocks to make txs confirm
283
283
generateBlocks(2 , Some (minerAddress))
284
284
// and we wait for the channel to close
285
- awaitCond(stateListenerC.expectMsgType[ChannelStateChanged ].currentState == CLOSED , max = 60 seconds)
286
- awaitCond(stateListenerF.expectMsgType[ChannelStateChanged ].currentState == CLOSED , max = 60 seconds)
285
+ awaitCond(stateListenerC.expectMsgType[ChannelStateChanged ](max = 60 seconds) .currentState == CLOSED , max = 60 seconds)
286
+ awaitCond(stateListenerF.expectMsgType[ChannelStateChanged ](max = 60 seconds) .currentState == CLOSED , max = 60 seconds)
287
287
awaitAnnouncements(1 )
288
288
}
289
289
@@ -334,8 +334,8 @@ abstract class ChannelIntegrationSpec extends IntegrationSpec {
334
334
// we generate blocks to make tx confirm
335
335
generateBlocks(2 , Some (minerAddress))
336
336
// and we wait for the channel to close
337
- awaitCond(stateListenerC.expectMsgType[ChannelStateChanged ].currentState == CLOSED , max = 60 seconds)
338
- awaitCond(stateListenerF.expectMsgType[ChannelStateChanged ].currentState == CLOSED , max = 60 seconds)
337
+ awaitCond(stateListenerC.expectMsgType[ChannelStateChanged ](max = 60 seconds) .currentState == CLOSED , max = 60 seconds)
338
+ awaitCond(stateListenerF.expectMsgType[ChannelStateChanged ](max = 60 seconds) .currentState == CLOSED , max = 60 seconds)
339
339
awaitAnnouncements(1 )
340
340
}
341
341
@@ -568,12 +568,16 @@ class StandardChannelIntegrationSpec extends ChannelIntegrationSpec {
568
568
fundee.register ! Register .Forward (sender.ref, channelId, CMD_CLOSE (sender.ref, Some (finalPubKeyScriptF)))
569
569
sender.expectMsgType[RES_SUCCESS [CMD_CLOSE ]]
570
570
// we then wait for C and F to negotiate the closing fee
571
- awaitCond(stateListener.expectMsgType[ChannelStateChanged ].currentState == CLOSING , max = 60 seconds)
571
+ awaitCond(stateListener.expectMsgType[ChannelStateChanged ](max = 60 seconds) .currentState == CLOSING , max = 60 seconds)
572
572
// and close the channel
573
- generateBlocks(2 )
574
- awaitCond(stateListener.expectMsgType[ChannelStateChanged ].currentState == CLOSED , max = 60 seconds)
575
-
576
573
val bitcoinClient = new ExtendedBitcoinClient (bitcoinrpcclient)
574
+ awaitCond({
575
+ bitcoinClient.getMempool().pipeTo(sender.ref)
576
+ sender.expectMsgType[Seq [Transaction ]].exists(_.txIn.head.outPoint.txid === fundingOutpoint.txid)
577
+ }, max = 20 seconds, interval = 1 second)
578
+ generateBlocks(3 )
579
+ awaitCond(stateListener.expectMsgType[ChannelStateChanged ](max = 60 seconds).currentState == CLOSED , max = 60 seconds)
580
+
577
581
bitcoinClient.lookForSpendingTx(None , fundingOutpoint.txid, fundingOutpoint.index.toInt).pipeTo(sender.ref)
578
582
val closingTx = sender.expectMsgType[Transaction ]
579
583
assert(closingTx.txOut.map(_.publicKeyScript).toSet === Set (finalPubKeyScriptC, finalPubKeyScriptF))
@@ -619,7 +623,7 @@ class StandardChannelIntegrationSpec extends ChannelIntegrationSpec {
619
623
// we generate blocks to make txs confirm
620
624
generateBlocks(2 )
621
625
// and we wait for C's channel to close
622
- awaitCond(stateListenerC.expectMsgType[ChannelStateChanged ].currentState == CLOSED , max = 60 seconds)
626
+ awaitCond(stateListenerC.expectMsgType[ChannelStateChanged ](max = 60 seconds) .currentState == CLOSED , max = 60 seconds)
623
627
awaitAnnouncements(1 )
624
628
}
625
629
@@ -717,7 +721,7 @@ class AnchorOutputChannelIntegrationSpec extends ChannelIntegrationSpec {
717
721
sender.send(nodes(" F" ).register, Register .Forward (sender.ref, channelId, CMD_FORCECLOSE (sender.ref)))
718
722
sender.expectMsgType[RES_SUCCESS [CMD_FORCECLOSE ]]
719
723
// we then wait for C to detect the unilateral close and go to CLOSING state
720
- awaitCond(stateListener.expectMsgType[ChannelStateChanged ].currentState == CLOSING , max = 60 seconds)
724
+ awaitCond(stateListener.expectMsgType[ChannelStateChanged ](max = 60 seconds) .currentState == CLOSING , max = 60 seconds)
721
725
722
726
val bitcoinClient = new ExtendedBitcoinClient (bitcoinrpcclient)
723
727
awaitCond({
@@ -736,7 +740,7 @@ class AnchorOutputChannelIntegrationSpec extends ChannelIntegrationSpec {
736
740
737
741
// get the claim-remote-output confirmed, then the channel can go to the CLOSED state
738
742
generateBlocks(2 )
739
- awaitCond(stateListener.expectMsgType[ChannelStateChanged ].currentState == CLOSED , max = 60 seconds)
743
+ awaitCond(stateListener.expectMsgType[ChannelStateChanged ](max = 60 seconds) .currentState == CLOSED , max = 60 seconds)
740
744
awaitAnnouncements(1 )
741
745
}
742
746
@@ -781,7 +785,7 @@ class AnchorOutputChannelIntegrationSpec extends ChannelIntegrationSpec {
781
785
// we generate blocks to make txs confirm
782
786
generateBlocks(2 )
783
787
// and we wait for C's channel to close
784
- awaitCond(stateListenerC.expectMsgType[ChannelStateChanged ].currentState == CLOSED , max = 60 seconds)
788
+ awaitCond(stateListenerC.expectMsgType[ChannelStateChanged ](max = 60 seconds) .currentState == CLOSED , max = 60 seconds)
785
789
awaitAnnouncements(1 )
786
790
}
787
791
0 commit comments