@@ -36,7 +36,7 @@ import fr.acinq.eclair.reputation.Reputation
3636import fr .acinq .eclair .testutils .PimpTestProbe .convert
3737import fr .acinq .eclair .transactions .Transactions
3838import fr .acinq .eclair .transactions .Transactions ._
39- import fr .acinq .eclair .wire .protocol .{AnnouncementSignatures , ChannelReestablish , ChannelUpdate , ClosingSigned , CommitSig , Error , FailureMessageCodecs , FailureReason , Init , PermanentChannelFailure , RevokeAndAck , Shutdown , UpdateAddHtlc , UpdateFailHtlc , UpdateFailMalformedHtlc , UpdateFee , UpdateFulfillHtlc }
39+ import fr .acinq .eclair .wire .protocol .{AnnouncementSignatures , ChannelReestablish , ChannelUpdate , ClosingComplete , ClosingSig , ClosingSigned , CommitSig , Error , FailureMessageCodecs , FailureReason , Init , PermanentChannelFailure , RevokeAndAck , Shutdown , UpdateAddHtlc , UpdateFailHtlc , UpdateFailMalformedHtlc , UpdateFee , UpdateFulfillHtlc }
4040import fr .acinq .eclair .{BlockHeight , CltvExpiry , CltvExpiryDelta , MilliSatoshiLong , TestConstants , TestKitBaseClass , randomBytes32 , randomKey }
4141import org .scalatest .funsuite .FixtureAnyFunSuiteLike
4242import org .scalatest .{Outcome , Tag }
@@ -1023,10 +1023,14 @@ class ShutdownStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike wit
10231023 alice2bob.forward(bob, channelReestablishAlice)
10241024 bob2alice.forward(alice, channelReestablishBob)
10251025 // They retransmit shutdown.
1026- alice2bob.expectMsgType[Shutdown ]
1027- alice2bob.forward(bob)
1028- bob2alice.expectMsgType[Shutdown ]
1029- bob2alice.forward(alice)
1026+ val shutdownAlice = alice2bob.expectMsgType[Shutdown ]
1027+ alice2bob.forward(bob, shutdownAlice)
1028+ val shutdownBob = bob2alice.expectMsgType[Shutdown ]
1029+ bob2alice.forward(alice, shutdownBob)
1030+ Seq (shutdownAlice, shutdownBob).foreach(shutdown => commitmentFormat match {
1031+ case _ : SegwitV0CommitmentFormat => assert(shutdown.closeeNonce_opt.isEmpty)
1032+ case _ : TaprootCommitmentFormat => assert(shutdown.closeeNonce_opt.nonEmpty)
1033+ })
10301034 // They resume HTLC settlement.
10311035 fulfillHtlc(0 , r1, bob, alice, bob2alice, alice2bob)
10321036 crossSign(bob, alice, bob2alice, alice2bob)
@@ -1035,6 +1039,14 @@ class ShutdownStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike wit
10351039 crossSign(bob, alice, bob2alice, alice2bob)
10361040 awaitCond(alice.stateName == NEGOTIATING_SIMPLE )
10371041 awaitCond(bob.stateName == NEGOTIATING_SIMPLE )
1042+ // They can now sign the closing transaction.
1043+ val closingCompleteAlice = alice2bob.expectMsgType[ClosingComplete ]
1044+ alice2bob.forward(bob, closingCompleteAlice)
1045+ bob2alice.expectMsgType[ClosingComplete ] // ignored
1046+ val closingTx = bob2blockchain.expectMsgType[PublishFinalTx ]
1047+ val closingSigBob = bob2alice.expectMsgType[ClosingSig ]
1048+ bob2alice.forward(alice, closingSigBob)
1049+ assert(alice2blockchain.expectMsgType[PublishFinalTx ].tx.txid == closingTx.tx.txid)
10381050 }
10391051
10401052 test(" recv INPUT_RESTORED" , Tag (ChannelStateTestsTags .SimpleClose ), Tag (ChannelStateTestsTags .AnchorOutputsZeroFeeHtlcTxs )) { f =>
0 commit comments