mirror of
https://github.com/ACINQ/eclair.git
synced 2024-11-19 09:54:02 +01:00
Fix race condition in integration test (#1564)
In the revoked commit tx case, both nodes are competing to claim the HTLC outputs from the commit tx. The test incorrectly assumed that node F would always win that race.
This commit is contained in:
parent
131b2e01c5
commit
bffb7a3fe1
@ -738,10 +738,11 @@ class AnchorOutputChannelIntegrationSpec extends ChannelIntegrationSpec {
|
||||
sender.expectMsg(revokedCommitTx.txid)
|
||||
// get the revoked commitment confirmed: now HTLC txs can be published
|
||||
generateBlocks(bitcoincli, 2)
|
||||
bitcoinClient.publishTransaction(htlcSuccess.head).pipeTo(sender.ref)
|
||||
sender.expectMsg(htlcSuccess.head.txid)
|
||||
bitcoinClient.publishTransaction(htlcTimeout.head).pipeTo(sender.ref)
|
||||
sender.expectMsg(htlcTimeout.head.txid)
|
||||
// NB: The test cannot be deterministic because there is a race between C and F here; C may publish more quickly and
|
||||
// claim the HTLC outputs directly from the commit tx. As a result we may have different combinations of transactions
|
||||
// if the test is run several times. It's okay, we just need to make sure that the test never fails.
|
||||
bitcoinClient.publishTransaction(htlcSuccess.head)
|
||||
bitcoinClient.publishTransaction(htlcTimeout.head)
|
||||
// at this point C should have 6 recv transactions: its previous main output, F's main output and all htlc outputs (taken as punishment)
|
||||
awaitCond({
|
||||
val receivedByC = listReceivedByAddress(finalAddressC, sender)
|
||||
|
Loading…
Reference in New Issue
Block a user