@@ -19,7 +19,7 @@ package fr.acinq.eclair.channel.states.c
1919import akka .actor .typed .scaladsl .adapter .{ClassicActorRefOps , actorRefAdapter }
2020import akka .testkit .{TestFSMRef , TestProbe }
2121import com .softwaremill .quicklens .{ModifyPimp , QuicklensAt }
22- import fr .acinq .bitcoin .scalacompat .{ByteVector32 , SatoshiLong , Transaction , TxIn }
22+ import fr .acinq .bitcoin .scalacompat .{ByteVector32 , SatoshiLong , Transaction }
2323import fr .acinq .eclair .blockchain .bitcoind .ZmqWatcher ._
2424import fr .acinq .eclair .blockchain .fee .FeeratePerKw
2525import fr .acinq .eclair .blockchain .{CurrentBlockHeight , SingleKeyOnChainWallet }
@@ -33,6 +33,7 @@ import fr.acinq.eclair.channel.publish.TxPublisher.{PublishFinalTx, SetChannelId
3333import fr .acinq .eclair .channel .states .ChannelStateTestsBase .FakeTxPublisherFactory
3434import fr .acinq .eclair .channel .states .{ChannelStateTestsBase , ChannelStateTestsTags }
3535import fr .acinq .eclair .transactions .Transactions
36+ import fr .acinq .eclair .transactions .Transactions .ClaimLocalAnchorOutputTx
3637import fr .acinq .eclair .wire .protocol ._
3738import fr .acinq .eclair .{BlockHeight , MilliSatoshiLong , TestConstants , TestKitBaseClass , ToMilliSatoshiConversion }
3839import org .scalatest .funsuite .FixtureAnyFunSuiteLike
@@ -751,7 +752,7 @@ class WaitForDualFundingConfirmedStateSpec extends TestKitBaseClass with Fixture
751752 val bobCommitTx = bob.stateData.asInstanceOf [DATA_WAIT_FOR_DUAL_FUNDING_CONFIRMED ].commitments.latest.localCommit.commitTxAndRemoteSig.commitTx
752753 alice ! WatchFundingSpentTriggered (bobCommitTx.tx)
753754 aliceListener.expectMsgType[TransactionPublished ]
754- val claimAnchor = alice2blockchain.expectMsgType[TxPublisher .PublishReplaceableTx ]
755+ assert( alice2blockchain.expectMsgType[TxPublisher .PublishReplaceableTx ].txInfo. isInstanceOf [ ClaimLocalAnchorOutputTx ])
755756 val claimMain = alice2blockchain.expectMsgType[TxPublisher .PublishFinalTx ]
756757 assert(claimMain.input.txid == bobCommitTx.tx.txid)
757758 assert(alice2blockchain.expectMsgType[WatchTxConfirmed ].txId == bobCommitTx.tx.txid)
@@ -777,6 +778,7 @@ class WaitForDualFundingConfirmedStateSpec extends TestKitBaseClass with Fixture
777778 assert(aliceListener.expectMsgType[TransactionConfirmed ].tx == fundingTx1)
778779 assert(aliceListener.expectMsgType[ShortChannelIdAssigned ].shortIds.real.isInstanceOf [RealScidStatus .Temporary ])
779780 assert(alice2blockchain.expectMsgType[WatchFundingSpent ].txId == fundingTx1.txid)
781+ alice2blockchain.expectMsg(UnwatchTxConfirmed (fundingTx2.txId))
780782 alice2blockchain.expectNoMessage(100 millis)
781783 alice2bob.expectNoMessage(100 millis)
782784 awaitCond(alice.stateData.isInstanceOf [DATA_WAIT_FOR_DUAL_FUNDING_READY ])
@@ -786,7 +788,7 @@ class WaitForDualFundingConfirmedStateSpec extends TestKitBaseClass with Fixture
786788 // Bob broadcasts his commit tx.
787789 alice ! WatchFundingSpentTriggered (bobCommitTx1)
788790 assert(aliceListener.expectMsgType[TransactionPublished ].tx.txid == bobCommitTx1.txid)
789- val claimAnchor = alice2blockchain.expectMsgType[TxPublisher .PublishReplaceableTx ]
791+ assert( alice2blockchain.expectMsgType[TxPublisher .PublishReplaceableTx ].txInfo. isInstanceOf [ ClaimLocalAnchorOutputTx ])
790792 val claimMain = alice2blockchain.expectMsgType[TxPublisher .PublishFinalTx ]
791793 assert(claimMain.input.txid == bobCommitTx1.txid)
792794 assert(alice2blockchain.expectMsgType[WatchTxConfirmed ].txId == bobCommitTx1.txid)
@@ -807,7 +809,7 @@ class WaitForDualFundingConfirmedStateSpec extends TestKitBaseClass with Fixture
807809 assert(aliceListener.expectMsgType[TransactionConfirmed ].tx == fundingTx)
808810 assert(alice2blockchain.expectMsgType[WatchFundingSpent ].txId == fundingTx.txid)
809811 alice2 ! WatchFundingSpentTriggered (bobData.commitments.latest.localCommit.commitTxAndRemoteSig.commitTx.tx)
810- val claimAnchorAlice = alice2blockchain.expectMsgType[TxPublisher .PublishReplaceableTx ]
812+ assert( alice2blockchain.expectMsgType[TxPublisher .PublishReplaceableTx ].txInfo. isInstanceOf [ ClaimLocalAnchorOutputTx ])
811813 val claimMainAlice = alice2blockchain.expectMsgType[TxPublisher .PublishFinalTx ]
812814 assert(claimMainAlice.input.txid == bobData.commitments.latest.localCommit.commitTxAndRemoteSig.commitTx.tx.txid)
813815 assert(alice2blockchain.expectMsgType[WatchTxConfirmed ].txId == bobData.commitments.latest.localCommit.commitTxAndRemoteSig.commitTx.tx.txid)
@@ -818,7 +820,7 @@ class WaitForDualFundingConfirmedStateSpec extends TestKitBaseClass with Fixture
818820 assert(bobListener.expectMsgType[TransactionConfirmed ].tx == fundingTx)
819821 assert(bob2blockchain.expectMsgType[WatchFundingSpent ].txId == fundingTx.txid)
820822 bob2 ! WatchFundingSpentTriggered (aliceData.commitments.latest.localCommit.commitTxAndRemoteSig.commitTx.tx)
821- val claimAnchorBob = bob2blockchain.expectMsgType[TxPublisher .PublishReplaceableTx ]
823+ assert( bob2blockchain.expectMsgType[TxPublisher .PublishReplaceableTx ].txInfo. isInstanceOf [ ClaimLocalAnchorOutputTx ])
822824 val claimMainBob = bob2blockchain.expectMsgType[TxPublisher .PublishFinalTx ]
823825 assert(claimMainBob.input.txid == aliceData.commitments.latest.localCommit.commitTxAndRemoteSig.commitTx.tx.txid)
824826 assert(bob2blockchain.expectMsgType[WatchTxConfirmed ].txId == aliceData.commitments.latest.localCommit.commitTxAndRemoteSig.commitTx.tx.txid)
@@ -844,8 +846,9 @@ class WaitForDualFundingConfirmedStateSpec extends TestKitBaseClass with Fixture
844846 alice2 ! WatchFundingConfirmedTriggered (BlockHeight (42000 ), 42 , fundingTx1)
845847 assert(aliceListener.expectMsgType[TransactionConfirmed ].tx == fundingTx1)
846848 assert(alice2blockchain.expectMsgType[WatchFundingSpent ].txId == fundingTx1.txid)
849+ alice2blockchain.expectMsg(UnwatchTxConfirmed (fundingTx2.txId))
847850 alice2 ! WatchFundingSpentTriggered (bobCommitTx1)
848- val claimAnchorAlice = alice2blockchain.expectMsgType[TxPublisher .PublishReplaceableTx ]
851+ assert( alice2blockchain.expectMsgType[TxPublisher .PublishReplaceableTx ].txInfo. isInstanceOf [ ClaimLocalAnchorOutputTx ])
849852 val claimMainAlice = alice2blockchain.expectMsgType[TxPublisher .PublishFinalTx ]
850853 assert(claimMainAlice.input.txid == bobCommitTx1.txid)
851854 assert(alice2blockchain.expectMsgType[WatchTxConfirmed ].txId == bobCommitTx1.txid)
@@ -856,8 +859,9 @@ class WaitForDualFundingConfirmedStateSpec extends TestKitBaseClass with Fixture
856859 bob2 ! WatchFundingConfirmedTriggered (BlockHeight (42000 ), 42 , fundingTx1)
857860 assert(bobListener.expectMsgType[TransactionConfirmed ].tx == fundingTx1)
858861 assert(bob2blockchain.expectMsgType[WatchFundingSpent ].txId == fundingTx1.txid)
862+ bob2blockchain.expectMsg(UnwatchTxConfirmed (fundingTx2.txId))
859863 bob2 ! WatchFundingSpentTriggered (aliceCommitTx1)
860- val claimAnchorBob = bob2blockchain.expectMsgType[TxPublisher .PublishReplaceableTx ]
864+ assert( bob2blockchain.expectMsgType[TxPublisher .PublishReplaceableTx ].txInfo. isInstanceOf [ ClaimLocalAnchorOutputTx ])
861865 val claimMainBob = bob2blockchain.expectMsgType[TxPublisher .PublishFinalTx ]
862866 assert(claimMainBob.input.txid == aliceCommitTx1.txid)
863867 assert(bob2blockchain.expectMsgType[WatchTxConfirmed ].txId == aliceCommitTx1.txid)
@@ -1016,7 +1020,7 @@ class WaitForDualFundingConfirmedStateSpec extends TestKitBaseClass with Fixture
10161020 awaitCond(alice.stateName == CLOSING )
10171021 aliceListener.expectMsgType[ChannelAborted ]
10181022 assert(alice2blockchain.expectMsgType[TxPublisher .PublishFinalTx ].tx.txid == aliceCommitTx.txid)
1019- val claimAnchorLocal = alice2blockchain.expectMsgType[TxPublisher .PublishReplaceableTx ]
1023+ assert( alice2blockchain.expectMsgType[TxPublisher .PublishReplaceableTx ].txInfo. isInstanceOf [ ClaimLocalAnchorOutputTx ])
10201024 val claimMainLocal = alice2blockchain.expectMsgType[TxPublisher .PublishFinalTx ]
10211025 assert(claimMainLocal.input.txid == aliceCommitTx.txid)
10221026 assert(alice2blockchain.expectMsgType[WatchTxConfirmed ].txId == aliceCommitTx.txid)
@@ -1025,7 +1029,7 @@ class WaitForDualFundingConfirmedStateSpec extends TestKitBaseClass with Fixture
10251029 val bobCommitTx = bob.stateData.asInstanceOf [DATA_WAIT_FOR_DUAL_FUNDING_CONFIRMED ].commitments.latest.localCommit.commitTxAndRemoteSig.commitTx.tx
10261030 alice ! WatchFundingSpentTriggered (bobCommitTx)
10271031 alice2blockchain.expectMsgType[WatchOutputSpent ]
1028- val claimAnchorRemote = alice2blockchain.expectMsgType[TxPublisher .PublishReplaceableTx ]
1032+ assert( alice2blockchain.expectMsgType[TxPublisher .PublishReplaceableTx ].txInfo. isInstanceOf [ ClaimLocalAnchorOutputTx ])
10291033 val claimMainRemote = alice2blockchain.expectMsgType[TxPublisher .PublishFinalTx ]
10301034 assert(claimMainRemote.input.txid == bobCommitTx.txid)
10311035 assert(alice2blockchain.expectMsgType[WatchTxConfirmed ].txId == bobCommitTx.txid)
@@ -1050,7 +1054,7 @@ class WaitForDualFundingConfirmedStateSpec extends TestKitBaseClass with Fixture
10501054 awaitCond(alice.stateName == CLOSING )
10511055 aliceListener.expectMsgType[ChannelAborted ]
10521056 assert(alice2blockchain.expectMsgType[TxPublisher .PublishFinalTx ].tx.txid == aliceCommitTx2.tx.txid)
1053- val claimAnchor2 = alice2blockchain.expectMsgType[TxPublisher .PublishReplaceableTx ]
1057+ assert( alice2blockchain.expectMsgType[TxPublisher .PublishReplaceableTx ].txInfo. isInstanceOf [ ClaimLocalAnchorOutputTx ])
10541058 val claimMain2 = alice2blockchain.expectMsgType[TxPublisher .PublishFinalTx ]
10551059 assert(claimMain2.input.txid == aliceCommitTx2.tx.txid)
10561060 assert(alice2blockchain.expectMsgType[WatchTxConfirmed ].txId == aliceCommitTx2.tx.txid)
@@ -1061,8 +1065,9 @@ class WaitForDualFundingConfirmedStateSpec extends TestKitBaseClass with Fixture
10611065 assert(aliceListener.expectMsgType[TransactionConfirmed ].tx == fundingTx1)
10621066 alice2blockchain.expectMsgType[WatchOutputSpent ]
10631067 assert(alice2blockchain.expectMsgType[WatchFundingSpent ].txId == fundingTx1.txid)
1068+ alice2blockchain.expectMsg(UnwatchTxConfirmed (fundingTx2.txId))
10641069 assert(alice2blockchain.expectMsgType[TxPublisher .PublishFinalTx ].tx.txid == aliceCommitTx1.tx.txid)
1065- val claimAnchor1 = alice2blockchain.expectMsgType[TxPublisher .PublishReplaceableTx ]
1070+ assert( alice2blockchain.expectMsgType[TxPublisher .PublishReplaceableTx ].txInfo. isInstanceOf [ ClaimLocalAnchorOutputTx ])
10661071 val claimMain1 = alice2blockchain.expectMsgType[TxPublisher .PublishFinalTx ]
10671072 assert(claimMain1.input.txid == aliceCommitTx1.tx.txid)
10681073 assert(alice2blockchain.expectMsgType[WatchTxConfirmed ].txId == aliceCommitTx1.tx.txid)
@@ -1072,7 +1077,7 @@ class WaitForDualFundingConfirmedStateSpec extends TestKitBaseClass with Fixture
10721077 // Bob publishes his commit tx, Alice reacts by spending her remote main output.
10731078 alice ! WatchFundingSpentTriggered (bobCommitTx1.tx)
10741079 alice2blockchain.expectMsgType[WatchOutputSpent ]
1075- val claimAnchorRemote = alice2blockchain.expectMsgType[TxPublisher .PublishReplaceableTx ]
1080+ assert( alice2blockchain.expectMsgType[TxPublisher .PublishReplaceableTx ].txInfo. isInstanceOf [ ClaimLocalAnchorOutputTx ])
10761081 val claimMainRemote = alice2blockchain.expectMsgType[TxPublisher .PublishFinalTx ]
10771082 assert(claimMainRemote.input.txid == bobCommitTx1.tx.txid)
10781083 assert(alice2blockchain.expectMsgType[WatchTxConfirmed ].txId == bobCommitTx1.tx.txid)
0 commit comments