From 9fa6fa537dbacbd20d50c5449f6150cc700eaca3 Mon Sep 17 00:00:00 2001 From: t-bast Date: Wed, 3 Feb 2021 15:33:01 +0100 Subject: [PATCH] Extract shared test tags --- .../states/StateTestsHelperMethods.scala | 19 ++++-- .../channel/states/e/NormalStateSpec.scala | 60 +++++++++---------- .../states/g/NegotiatingStateSpec.scala | 6 +- .../channel/states/h/ClosingStateSpec.scala | 30 +++++----- 4 files changed, 63 insertions(+), 52 deletions(-) diff --git a/eclair-core/src/test/scala/fr/acinq/eclair/channel/states/StateTestsHelperMethods.scala b/eclair-core/src/test/scala/fr/acinq/eclair/channel/states/StateTestsHelperMethods.scala index c89f9e6e4f..7b630d45bc 100644 --- a/eclair-core/src/test/scala/fr/acinq/eclair/channel/states/StateTestsHelperMethods.scala +++ b/eclair-core/src/test/scala/fr/acinq/eclair/channel/states/StateTestsHelperMethods.scala @@ -49,6 +49,17 @@ trait StateTestsBase extends StateTestsHelperMethods with FixtureTestSuite with } +object StateTestsTags { + /** If set, channels will use option_static_remotekey. */ + val StaticRemoteKey = "static_remotekey" + /** If set, channels will use option_anchor_outputs. */ + val AnchorOutputs = "anchor_outputs" + /** If set, channels will be public (otherwise we don't announce them by default). */ + val ChannelsPublic = "channels_public" + /** If set, no amount will be pushed when opening a channel (by default we push a small amount). */ + val NoPushMsat = "no_push_msat" +} + trait StateTestsHelperMethods extends TestKitBase { case class SetupFixture(alice: TestFSMRef[State, Data, Channel], @@ -87,12 +98,12 @@ trait StateTestsHelperMethods extends TestKitBase { def reachNormal(setup: SetupFixture, tags: Set[String] = Set.empty): Unit = { import setup._ - val channelFlags = if (tags.contains("channels_public")) ChannelFlags.AnnounceChannel else ChannelFlags.Empty - val pushMsat = if (tags.contains("no_push_msat")) 0.msat else TestConstants.pushMsat - val (aliceParams, bobParams, channelVersion) = if (tags.contains("anchor_outputs")) { + val channelFlags = if (tags.contains(StateTestsTags.ChannelsPublic)) ChannelFlags.AnnounceChannel else ChannelFlags.Empty + val pushMsat = if (tags.contains(StateTestsTags.NoPushMsat)) 0.msat else TestConstants.pushMsat + val (aliceParams, bobParams, channelVersion) = if (tags.contains(StateTestsTags.AnchorOutputs)) { val features = Features(Set(ActivatedFeature(Features.StaticRemoteKey, FeatureSupport.Mandatory), ActivatedFeature(Features.AnchorOutputs, FeatureSupport.Optional))) (Alice.channelParams.copy(features = features), Bob.channelParams.copy(features = features), ChannelVersion.ANCHOR_OUTPUTS) - } else if (tags.contains("static_remotekey")) { + } else if (tags.contains(StateTestsTags.StaticRemoteKey)) { val features = Features(Set(ActivatedFeature(Features.StaticRemoteKey, FeatureSupport.Optional))) val aliceParams = Alice.channelParams.copy(features = features, walletStaticPaymentBasepoint = Some(Helpers.getWalletPaymentBasepoint(wallet))) val bobParams = Bob.channelParams.copy(features = features, walletStaticPaymentBasepoint = Some(Helpers.getWalletPaymentBasepoint(wallet))) diff --git a/eclair-core/src/test/scala/fr/acinq/eclair/channel/states/e/NormalStateSpec.scala b/eclair-core/src/test/scala/fr/acinq/eclair/channel/states/e/NormalStateSpec.scala index 5d76292e72..1147d6002d 100644 --- a/eclair-core/src/test/scala/fr/acinq/eclair/channel/states/e/NormalStateSpec.scala +++ b/eclair-core/src/test/scala/fr/acinq/eclair/channel/states/e/NormalStateSpec.scala @@ -28,7 +28,7 @@ import fr.acinq.eclair.blockchain._ import fr.acinq.eclair.blockchain.fee.{FeeratePerKw, FeeratesPerKw} import fr.acinq.eclair.channel.Channel._ import fr.acinq.eclair.channel._ -import fr.acinq.eclair.channel.states.StateTestsBase +import fr.acinq.eclair.channel.states.{StateTestsBase, StateTestsTags} import fr.acinq.eclair.crypto.Sphinx import fr.acinq.eclair.io.Peer import fr.acinq.eclair.payment.OutgoingPacket @@ -198,7 +198,7 @@ class NormalStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with bob2alice.expectNoMsg(200 millis) } - test("recv CMD_ADD_HTLC (increasing balance but still below reserve)", Tag("no_push_msat")) { f => + test("recv CMD_ADD_HTLC (increasing balance but still below reserve)", Tag(StateTestsTags.NoPushMsat)) { f => import f._ val sender = TestProbe() // channel starts with all funds on alice's side, alice sends some funds to bob, but not enough to make it go above reserve @@ -219,7 +219,7 @@ class NormalStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with alice2bob.expectNoMsg(200 millis) } - test("recv CMD_ADD_HTLC (insufficient funds) (anchor outputs)", Tag("anchor_outputs")) { f => + test("recv CMD_ADD_HTLC (insufficient funds) (anchor outputs)", Tag(StateTestsTags.AnchorOutputs)) { f => import f._ val sender = TestProbe() val initialState = alice.stateData.asInstanceOf[DATA_NORMAL] @@ -488,7 +488,7 @@ class NormalStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with bob2blockchain.expectMsgType[WatchConfirmed] } - test("recv UpdateAddHtlc (insufficient funds w/ pending htlcs) (anchor outputs)", Tag("anchor_outputs")) { f => + test("recv UpdateAddHtlc (insufficient funds w/ pending htlcs) (anchor outputs)", Tag(StateTestsTags.AnchorOutputs)) { f => import f._ val tx = bob.stateData.asInstanceOf[DATA_NORMAL].commitments.localCommit.publishableTxs.commitTx.tx alice2bob.forward(bob, UpdateAddHtlc(ByteVector32.Zeroes, 0, 400000000 msat, randomBytes32, CltvExpiryDelta(144).toCltvExpiry(currentBlockHeight), TestConstants.emptyOnionPacket)) @@ -722,7 +722,7 @@ class NormalStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with assert(alice.stateData.asInstanceOf[DATA_NORMAL].commitments.remoteNextCommitInfo === Left(waitForRevocation.copy(reSignAsap = true))) } - test("recv CMD_SIGN (going above reserve)", Tag("no_push_msat")) { f => + test("recv CMD_SIGN (going above reserve)", Tag(StateTestsTags.NoPushMsat)) { f => import f._ val sender = TestProbe() // channel starts with all funds on alice's side, so channel will be initially disabled on bob's side @@ -1149,11 +1149,11 @@ class NormalStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with assert(initialToRemoteScript == aliceToRemoteScript()) } - test("recv RevokeAndAck (one htlc sent, static_remotekey)", Tag("static_remotekey")) { + test("recv RevokeAndAck (one htlc sent, static_remotekey)", Tag(StateTestsTags.StaticRemoteKey)) { testRevokeAndAckHtlcStaticRemoteKey _ } - test("recv RevokeAndAck (one htlc sent, anchor outputs)", Tag("anchor_outputs")) { + test("recv RevokeAndAck (one htlc sent, anchor outputs)", Tag(StateTestsTags.AnchorOutputs)) { testRevokeAndAckHtlcStaticRemoteKey _ } @@ -1191,11 +1191,11 @@ class NormalStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with testReceiveCmdFulfillHtlc _ } - test("recv CMD_FULFILL_HTLC (static_remotekey)", Tag("static_remotekey")) { + test("recv CMD_FULFILL_HTLC (static_remotekey)", Tag(StateTestsTags.StaticRemoteKey)) { testReceiveCmdFulfillHtlc _ } - test("recv CMD_FULFILL_HTLC (anchor_outputs)", Tag("anchor_outputs")) { + test("recv CMD_FULFILL_HTLC (anchor_outputs)", Tag(StateTestsTags.AnchorOutputs)) { testReceiveCmdFulfillHtlc _ } @@ -1280,7 +1280,7 @@ class NormalStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with testUpdateFulfillHtlc _ } - test("recv UpdateFulfillHtlc (anchor_outputs)", Tag("anchor_outputs")) { + test("recv UpdateFulfillHtlc (anchor_outputs)", Tag(StateTestsTags.AnchorOutputs)) { testUpdateFulfillHtlc _ } @@ -1356,11 +1356,11 @@ class NormalStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with testCmdFailHtlc _ } - test("recv CMD_FAIL_HTLC (static_remotekey)", Tag("static_remotekey")) { + test("recv CMD_FAIL_HTLC (static_remotekey)", Tag(StateTestsTags.StaticRemoteKey)) { testCmdFailHtlc _ } - test("recv CMD_FAIL_HTLC (anchor_outputs)", Tag("anchor_outputs")) { + test("recv CMD_FAIL_HTLC (anchor_outputs)", Tag(StateTestsTags.AnchorOutputs)) { testCmdFailHtlc _ } @@ -1452,11 +1452,11 @@ class NormalStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with testUpdateFailHtlc _ } - test("recv UpdateFailHtlc (static_remotekey)", Tag("static_remotekey")) { + test("recv UpdateFailHtlc (static_remotekey)", Tag(StateTestsTags.StaticRemoteKey)) { testUpdateFailHtlc _ } - test("recv UpdateFailHtlc (anchor_outputs)", Tag("anchor_outputs")) { + test("recv UpdateFailHtlc (anchor_outputs)", Tag(StateTestsTags.AnchorOutputs)) { testUpdateFailHtlc _ } @@ -1563,7 +1563,7 @@ class NormalStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with testCmdUpdateFee _ } - test("recv CMD_UPDATE_FEE (anchor outputs)", Tag("anchor_outputs")) { + test("recv CMD_UPDATE_FEE (anchor outputs)", Tag(StateTestsTags.AnchorOutputs)) { testCmdUpdateFee _ } @@ -1597,7 +1597,7 @@ class NormalStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with awaitCond(bob.stateData == initialData.copy(commitments = initialData.commitments.copy(remoteChanges = initialData.commitments.remoteChanges.copy(proposed = initialData.commitments.remoteChanges.proposed :+ fee), remoteNextHtlcId = 0))) } - test("recv UpdateFee (anchor outputs)", Tag("anchor_outputs")) { f => + test("recv UpdateFee (anchor outputs)", Tag(StateTestsTags.AnchorOutputs)) { f => import f._ val initialData = bob.stateData.asInstanceOf[DATA_NORMAL] val fee = UpdateFee(ByteVector32.Zeroes, FeeratePerKw(8000 sat)) @@ -1645,7 +1645,7 @@ class NormalStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with bob2blockchain.expectMsgType[WatchConfirmed] } - test("recv UpdateFee (sender can't afford it) (anchor outputs)", Tag("anchor_outputs")) { f => + test("recv UpdateFee (sender can't afford it) (anchor outputs)", Tag(StateTestsTags.AnchorOutputs)) { f => import f._ val tx = bob.stateData.asInstanceOf[DATA_NORMAL].commitments.localCommit.publishableTxs.commitTx.tx // This feerate is just above the threshold: (800000 (alice balance) - 20000 (reserve) - 660 (anchors)) / 1124 (commit tx weight) = 693363 @@ -1732,7 +1732,7 @@ class NormalStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with testCmdClose _ } - test("recv CMD_CLOSE (no pending htlcs) (anchor outputs)", Tag("anchor_outputs")) { + test("recv CMD_CLOSE (no pending htlcs) (anchor outputs)", Tag(StateTestsTags.AnchorOutputs)) { testCmdClose _ } @@ -1826,7 +1826,7 @@ class NormalStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with testShutdown _ } - test("recv Shutdown (no pending htlcs) (anchor outputs)", Tag("anchor_outputs")) { + test("recv Shutdown (no pending htlcs) (anchor outputs)", Tag(StateTestsTags.AnchorOutputs)) { testShutdown _ } @@ -1904,7 +1904,7 @@ class NormalStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with testShutdownWithHtlcs _ } - test("recv Shutdown (with signed htlcs) (anchor outputs)", Tag("anchor_outputs")) { + test("recv Shutdown (with signed htlcs) (anchor outputs)", Tag(StateTestsTags.AnchorOutputs)) { testShutdownWithHtlcs _ } @@ -2450,7 +2450,7 @@ class NormalStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with assert(localCommitPublished.claimHtlcDelayedTxs.size == 3) } - test("recv Error (nothing at stake)", Tag("no_push_msat")) { f => + test("recv Error (nothing at stake)", Tag(StateTestsTags.NoPushMsat)) { f => import f._ // when receiving an error bob should publish its commitment even if it has nothing at stake, because alice could @@ -2469,7 +2469,7 @@ class NormalStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with assert(localCommitPublished.commitTx == bobCommitTx) } - test("recv BITCOIN_FUNDING_DEEPLYBURIED", Tag("channels_public")) { f => + test("recv BITCOIN_FUNDING_DEEPLYBURIED", Tag(StateTestsTags.ChannelsPublic)) { f => import f._ alice ! WatchEventConfirmed(BITCOIN_FUNDING_DEEPLYBURIED, 400000, 42, null) val annSigs = alice2bob.expectMsgType[AnnouncementSignatures] @@ -2480,7 +2480,7 @@ class NormalStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with channelUpdateListener.expectNoMsg(1 second) } - test("recv BITCOIN_FUNDING_DEEPLYBURIED (short channel id changed)", Tag("channels_public")) { f => + test("recv BITCOIN_FUNDING_DEEPLYBURIED (short channel id changed)", Tag(StateTestsTags.ChannelsPublic)) { f => import f._ alice ! WatchEventConfirmed(BITCOIN_FUNDING_DEEPLYBURIED, 400001, 22, null) val annSigs = alice2bob.expectMsgType[AnnouncementSignatures] @@ -2512,7 +2512,7 @@ class NormalStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with channelUpdateListener.expectNoMsg(1 second) } - test("recv AnnouncementSignatures", Tag("channels_public")) { f => + test("recv AnnouncementSignatures", Tag(StateTestsTags.ChannelsPublic)) { f => import f._ val initialState = alice.stateData.asInstanceOf[DATA_NORMAL] alice ! WatchEventConfirmed(BITCOIN_FUNDING_DEEPLYBURIED, 400000, 42, null) @@ -2530,7 +2530,7 @@ class NormalStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with assert(channelUpdateListener.expectMsgType[LocalChannelUpdate].channelAnnouncement_opt === Some(channelAnn)) } - test("recv AnnouncementSignatures (re-send)", Tag("channels_public")) { f => + test("recv AnnouncementSignatures (re-send)", Tag(StateTestsTags.ChannelsPublic)) { f => import f._ val initialState = alice.stateData.asInstanceOf[DATA_NORMAL] alice ! WatchEventConfirmed(BITCOIN_FUNDING_DEEPLYBURIED, 42, 10, null) @@ -2549,7 +2549,7 @@ class NormalStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with alice2bob.expectMsg(annSigsA) } - test("recv AnnouncementSignatures (invalid)", Tag("channels_public")) { f => + test("recv AnnouncementSignatures (invalid)", Tag(StateTestsTags.ChannelsPublic)) { f => import f._ val channelId = alice.stateData.asInstanceOf[DATA_NORMAL].channelId alice ! WatchEventConfirmed(BITCOIN_FUNDING_DEEPLYBURIED, 400000, 42, null) @@ -2565,7 +2565,7 @@ class NormalStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with awaitCond(alice.stateName == CLOSING) } - test("recv BroadcastChannelUpdate", Tag("channels_public")) { f => + test("recv BroadcastChannelUpdate", Tag(StateTestsTags.ChannelsPublic)) { f => import f._ alice ! WatchEventConfirmed(BITCOIN_FUNDING_DEEPLYBURIED, 400000, 42, null) bob ! WatchEventConfirmed(BITCOIN_FUNDING_DEEPLYBURIED, 400000, 42, null) @@ -2580,7 +2580,7 @@ class NormalStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with assert(update1.channelUpdate.timestamp < update2.channelUpdate.timestamp) } - test("recv BroadcastChannelUpdate (no changes)", Tag("channels_public")) { f => + test("recv BroadcastChannelUpdate (no changes)", Tag(StateTestsTags.ChannelsPublic)) { f => import f._ alice ! WatchEventConfirmed(BITCOIN_FUNDING_DEEPLYBURIED, 400000, 42, null) bob ! WatchEventConfirmed(BITCOIN_FUNDING_DEEPLYBURIED, 400000, 42, null) @@ -2629,7 +2629,7 @@ class NormalStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with awaitCond(alice.stateName == OFFLINE) } - test("recv INPUT_DISCONNECTED (public channel)", Tag("channels_public")) { f => + test("recv INPUT_DISCONNECTED (public channel)", Tag(StateTestsTags.ChannelsPublic)) { f => import f._ alice ! WatchEventConfirmed(BITCOIN_FUNDING_DEEPLYBURIED, 400000, 42, null) bob ! WatchEventConfirmed(BITCOIN_FUNDING_DEEPLYBURIED, 400000, 42, null) @@ -2644,7 +2644,7 @@ class NormalStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with channelUpdateListener.expectNoMsg(1 second) } - test("recv INPUT_DISCONNECTED (public channel, with pending unsigned htlcs)", Tag("channels_public")) { f => + test("recv INPUT_DISCONNECTED (public channel, with pending unsigned htlcs)", Tag(StateTestsTags.ChannelsPublic)) { f => import f._ val sender = TestProbe() alice ! WatchEventConfirmed(BITCOIN_FUNDING_DEEPLYBURIED, 400000, 42, null) diff --git a/eclair-core/src/test/scala/fr/acinq/eclair/channel/states/g/NegotiatingStateSpec.scala b/eclair-core/src/test/scala/fr/acinq/eclair/channel/states/g/NegotiatingStateSpec.scala index 17d0ec153d..88a67314c6 100644 --- a/eclair-core/src/test/scala/fr/acinq/eclair/channel/states/g/NegotiatingStateSpec.scala +++ b/eclair-core/src/test/scala/fr/acinq/eclair/channel/states/g/NegotiatingStateSpec.scala @@ -24,7 +24,7 @@ import fr.acinq.eclair.blockchain._ import fr.acinq.eclair.blockchain.fee.{FeeratePerKw, FeeratesPerKw} import fr.acinq.eclair.channel.Helpers.Closing import fr.acinq.eclair.channel._ -import fr.acinq.eclair.channel.states.StateTestsBase +import fr.acinq.eclair.channel.states.{StateTestsBase, StateTestsTags} import fr.acinq.eclair.wire.{ClosingSigned, Error, Shutdown} import fr.acinq.eclair.{CltvExpiry, MilliSatoshiLong, TestConstants, TestKitBaseClass} import org.scalatest.funsuite.FixtureAnyFunSuiteLike @@ -111,7 +111,7 @@ class NegotiatingStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike testClosingSigned _ } - test("recv ClosingSigned (anchor outputs)", Tag("anchor_outputs")) { + test("recv ClosingSigned (anchor outputs)", Tag(StateTestsTags.AnchorOutputs)) { testClosingSigned _ } @@ -136,7 +136,7 @@ class NegotiatingStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike testFeeConverge(f) } - test("recv ClosingSigned (nothing at stake)", Tag("no_push_msat")) { f => + test("recv ClosingSigned (nothing at stake)", Tag(StateTestsTags.NoPushMsat)) { f => import f._ val aliceCloseFee = alice2bob.expectMsgType[ClosingSigned].feeSatoshis alice2bob.forward(bob) diff --git a/eclair-core/src/test/scala/fr/acinq/eclair/channel/states/h/ClosingStateSpec.scala b/eclair-core/src/test/scala/fr/acinq/eclair/channel/states/h/ClosingStateSpec.scala index 62c4b3dc27..7d2febd40e 100644 --- a/eclair-core/src/test/scala/fr/acinq/eclair/channel/states/h/ClosingStateSpec.scala +++ b/eclair-core/src/test/scala/fr/acinq/eclair/channel/states/h/ClosingStateSpec.scala @@ -24,7 +24,7 @@ import fr.acinq.eclair.blockchain._ import fr.acinq.eclair.blockchain.fee.{FeeratePerKw, FeeratesPerKw} import fr.acinq.eclair.channel.Helpers.Closing import fr.acinq.eclair.channel._ -import fr.acinq.eclair.channel.states.StateTestsBase +import fr.acinq.eclair.channel.states.{StateTestsBase, StateTestsTags} import fr.acinq.eclair.payment._ import fr.acinq.eclair.payment.relay.Relayer._ import fr.acinq.eclair.transactions.{Scripts, Transactions} @@ -330,7 +330,7 @@ class ClosingStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with testMutualCloseBeforeConverge(f, ChannelVersion.STANDARD) } - test("recv BITCOIN_FUNDING_SPENT (mutual close before converging, anchor outputs)", Tag("anchor_outputs")) { f => + test("recv BITCOIN_FUNDING_SPENT (mutual close before converging, anchor outputs)", Tag(StateTestsTags.AnchorOutputs)) { f => testMutualCloseBeforeConverge(f, ChannelVersion.ANCHOR_OUTPUTS) } @@ -433,7 +433,7 @@ class ClosingStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with testLocalCommitTxConfirmed(f, ChannelVersion.STANDARD) } - test("recv BITCOIN_TX_CONFIRMED (local commit, anchor outputs)", Tag("anchor_outputs")) { f => + test("recv BITCOIN_TX_CONFIRMED (local commit, anchor outputs)", Tag(StateTestsTags.AnchorOutputs)) { f => testLocalCommitTxConfirmed(f, ChannelVersion.ANCHOR_OUTPUTS) } @@ -593,7 +593,7 @@ class ClosingStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with awaitCond(alice.stateName == CLOSED) } - test("recv BITCOIN_TX_CONFIRMED (remote commit, option_static_remotekey)", Tag("static_remotekey")) { f => + test("recv BITCOIN_TX_CONFIRMED (remote commit, option_static_remotekey)", Tag(StateTestsTags.StaticRemoteKey)) { f => import f._ mutualClose(alice, bob, alice2bob, bob2alice, alice2blockchain, bob2blockchain) assert(alice.stateData.asInstanceOf[DATA_CLOSING].commitments.channelVersion === ChannelVersion.STATIC_REMOTEKEY) @@ -610,7 +610,7 @@ class ClosingStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with awaitCond(alice.stateName == CLOSED) } - test("recv BITCOIN_TX_CONFIRMED (remote commit, anchor outputs)", Tag("anchor_outputs")) { f => + test("recv BITCOIN_TX_CONFIRMED (remote commit, anchor outputs)", Tag(StateTestsTags.AnchorOutputs)) { f => import f._ mutualClose(alice, bob, alice2bob, bob2alice, alice2blockchain, bob2blockchain) val initialState = alice.stateData.asInstanceOf[DATA_CLOSING] @@ -673,7 +673,7 @@ class ClosingStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with testRemoteCommitTxWithHtlcsConfirmed(f, ChannelVersion.STANDARD) } - test("recv BITCOIN_TX_CONFIRMED (remote commit with multiple htlcs for the same payment, anchor outputs)", Tag("anchor_outputs")) { f => + test("recv BITCOIN_TX_CONFIRMED (remote commit with multiple htlcs for the same payment, anchor outputs)", Tag(StateTestsTags.AnchorOutputs)) { f => testRemoteCommitTxWithHtlcsConfirmed(f, ChannelVersion.ANCHOR_OUTPUTS) } @@ -778,7 +778,7 @@ class ClosingStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with awaitCond(alice.stateName == CLOSED) } - test("recv BITCOIN_TX_CONFIRMED (next remote commit, static_remotekey)", Tag("static_remotekey")) { f => + test("recv BITCOIN_TX_CONFIRMED (next remote commit, static_remotekey)", Tag(StateTestsTags.StaticRemoteKey)) { f => import f._ val (bobCommitTx, closingState, htlcs) = testNextRemoteCommitTxConfirmed(f, ChannelVersion.STATIC_REMOTEKEY) alice ! WatchEventConfirmed(BITCOIN_TX_CONFIRMED(bobCommitTx), 42, 0, bobCommitTx) @@ -797,7 +797,7 @@ class ClosingStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with awaitCond(alice.stateName == CLOSED) } - test("recv BITCOIN_TX_CONFIRMED (next remote commit, anchor outputs)", Tag("anchor_outputs")) { f => + test("recv BITCOIN_TX_CONFIRMED (next remote commit, anchor outputs)", Tag(StateTestsTags.AnchorOutputs)) { f => import f._ val (bobCommitTx, closingState, htlcs) = testNextRemoteCommitTxConfirmed(f, ChannelVersion.ANCHOR_OUTPUTS) alice ! WatchEventConfirmed(BITCOIN_TX_CONFIRMED(bobCommitTx), 42, 0, bobCommitTx) @@ -929,7 +929,7 @@ class ClosingStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with awaitCond(alice.stateName == CLOSED) } - test("recv BITCOIN_TX_CONFIRMED (future remote commit, option_static_remotekey)", Tag("static_remotekey")) { f => + test("recv BITCOIN_TX_CONFIRMED (future remote commit, option_static_remotekey)", Tag(StateTestsTags.StaticRemoteKey)) { f => import f._ val bobCommitTx = testFutureRemoteCommitTxConfirmed(f, ChannelVersion.STATIC_REMOTEKEY) // using option_static_remotekey alice doesn't need to sweep her output @@ -939,7 +939,7 @@ class ClosingStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with awaitCond(alice.stateName == CLOSED, 10 seconds) } - test("recv BITCOIN_TX_CONFIRMED (future remote commit, anchor outputs)", Tag("anchor_outputs")) { f => + test("recv BITCOIN_TX_CONFIRMED (future remote commit, anchor outputs)", Tag(StateTestsTags.AnchorOutputs)) { f => import f._ val bobCommitTx = testFutureRemoteCommitTxConfirmed(f, ChannelVersion.ANCHOR_OUTPUTS) // alice is able to claim its main output @@ -1091,11 +1091,11 @@ class ClosingStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with testFundingSpentRevokedTx(f, ChannelVersion.STANDARD) } - test("recv BITCOIN_FUNDING_SPENT (one revoked tx, option_static_remotekey)", Tag("static_remotekey")) { f => + test("recv BITCOIN_FUNDING_SPENT (one revoked tx, option_static_remotekey)", Tag(StateTestsTags.StaticRemoteKey)) { f => testFundingSpentRevokedTx(f, ChannelVersion.STATIC_REMOTEKEY) } - test("recv BITCOIN_FUNDING_SPENT (one revoked tx, anchor outputs)", Tag("anchor_outputs")) { f => + test("recv BITCOIN_FUNDING_SPENT (one revoked tx, anchor outputs)", Tag(StateTestsTags.AnchorOutputs)) { f => testFundingSpentRevokedTx(f, ChannelVersion.ANCHOR_OUTPUTS) } @@ -1244,11 +1244,11 @@ class ClosingStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with testOutputSpentRevokedTx(f, ChannelVersion.STANDARD) } - test("recv BITCOIN_OUTPUT_SPENT (one revoked tx, counterparty published htlc-success tx, option_static_remotekey)", Tag("static_remotekey")) { f => + test("recv BITCOIN_OUTPUT_SPENT (one revoked tx, counterparty published htlc-success tx, option_static_remotekey)", Tag(StateTestsTags.StaticRemoteKey)) { f => testOutputSpentRevokedTx(f, ChannelVersion.STATIC_REMOTEKEY) } - test("recv BITCOIN_OUTPUT_SPENT (one revoked tx, counterparty published htlc-success tx, anchor outputs)", Tag("anchor_outputs")) { f => + test("recv BITCOIN_OUTPUT_SPENT (one revoked tx, counterparty published htlc-success tx, anchor outputs)", Tag(StateTestsTags.AnchorOutputs)) { f => testOutputSpentRevokedTx(f, ChannelVersion.ANCHOR_OUTPUTS) } @@ -1301,7 +1301,7 @@ class ClosingStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with testRevokedTxConfirmed(f, ChannelVersion.STANDARD) } - test("recv BITCOIN_TX_CONFIRMED (one revoked tx, pending htlcs, anchor outputs)", Tag("anchor_outputs")) { f => + test("recv BITCOIN_TX_CONFIRMED (one revoked tx, pending htlcs, anchor outputs)", Tag(StateTestsTags.AnchorOutputs)) { f => testRevokedTxConfirmed(f, ChannelVersion.ANCHOR_OUTPUTS) }