Skip to content

Commit 3d1e09e

Browse files
committed
Fix integration tests
We now require at least `option_static_remotekey`.
1 parent 1edb441 commit 3d1e09e

File tree

4 files changed

+39
-31
lines changed

4 files changed

+39
-31
lines changed

eclair-core/src/test/scala/fr/acinq/eclair/integration/ChannelIntegrationSpec.scala

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -183,12 +183,15 @@ abstract class ChannelIntegrationSpec extends IntegrationSpec {
183183
paymentSender.expectMsgType[PaymentSent](max = 60 seconds)
184184
// we then generate enough blocks so that nodes get their main delayed output
185185
generateBlocks(25, Some(minerAddress))
186-
// F should have 2 recv transactions: the redeemed htlc and its main output
187-
// C should have 1 recv transaction: its main output
186+
val expectedTxCountC = 1 // C should have 1 recv transaction: its main output
187+
val expectedTxCountF = commitmentFormat match {
188+
case _: AnchorOutputsCommitmentFormat => 2 // F should have 2 recv transactions: the redeemed htlc and its main output
189+
case Transactions.DefaultCommitmentFormat => 1 // F's main output uses static_remotekey
190+
}
188191
awaitCond({
189192
val receivedByC = listReceivedByAddress(finalAddressC, sender)
190193
val receivedByF = listReceivedByAddress(finalAddressF)
191-
(receivedByF diff previouslyReceivedByF).size == 2 && (receivedByC diff previouslyReceivedByC).size == 1
194+
(receivedByF diff previouslyReceivedByF).size == expectedTxCountF && (receivedByC diff previouslyReceivedByC).size == expectedTxCountC
192195
}, max = 30 seconds, interval = 1 second)
193196
// we generate blocks to make txs confirm
194197
generateBlocks(2, Some(minerAddress))
@@ -221,12 +224,15 @@ abstract class ChannelIntegrationSpec extends IntegrationSpec {
221224
paymentSender.expectMsgType[PaymentSent](max = 60 seconds)
222225
// we then generate enough blocks so that F gets its htlc-success delayed output
223226
generateBlocks(25, Some(minerAddress))
224-
// F should have 2 recv transactions: the redeemed htlc and its main output
225-
// C should have 1 recv transaction: its main output
227+
val expectedTxCountC = commitmentFormat match {
228+
case _: AnchorOutputsCommitmentFormat => 1 // C should have 1 recv transaction: its main output
229+
case Transactions.DefaultCommitmentFormat => 0 // C's main output uses static_remotekey
230+
}
231+
val expectedTxCountF = 2 // F should have 2 recv transactions: the redeemed htlc and its main output
226232
awaitCond({
227233
val receivedByC = listReceivedByAddress(finalAddressC, sender)
228234
val receivedByF = listReceivedByAddress(finalAddressF, sender)
229-
(receivedByF diff previouslyReceivedByF).size == 2 && (receivedByC diff previouslyReceivedByC).size == 1
235+
(receivedByF diff previouslyReceivedByF).size == expectedTxCountF && (receivedByC diff previouslyReceivedByC).size == expectedTxCountC
230236
}, max = 30 seconds, interval = 1 second)
231237
// we generate blocks to make txs confirm
232238
generateBlocks(2, Some(minerAddress))
@@ -271,12 +277,15 @@ abstract class ChannelIntegrationSpec extends IntegrationSpec {
271277
assert(failed.failures.head.asInstanceOf[RemoteFailure].e == DecryptedFailurePacket(nodes("C").nodeParams.nodeId, PermanentChannelFailure()))
272278
// we then generate enough blocks to confirm all delayed transactions
273279
generateBlocks(25, Some(minerAddress))
274-
// C should have 2 recv transactions: its main output and the htlc timeout
275-
// F should have 1 recv transaction: its main output
280+
val expectedTxCountC = 2 // C should have 2 recv transactions: its main output and the htlc timeout
281+
val expectedTxCountF = commitmentFormat match {
282+
case _: AnchorOutputsCommitmentFormat => 1 // F should have 1 recv transaction: its main output
283+
case Transactions.DefaultCommitmentFormat => 0 // F's main output uses static_remotekey
284+
}
276285
awaitCond({
277286
val receivedByC = listReceivedByAddress(finalAddressC, sender)
278287
val receivedByF = listReceivedByAddress(finalAddressF, sender)
279-
(receivedByF diff previouslyReceivedByF).size == 1 && (receivedByC diff previouslyReceivedByC).size == 2
288+
(receivedByF diff previouslyReceivedByF).size == expectedTxCountF && (receivedByC diff previouslyReceivedByC).size == expectedTxCountC
280289
}, max = 30 seconds, interval = 1 second)
281290
// we generate blocks to make txs confirm
282291
generateBlocks(2, Some(minerAddress))
@@ -324,12 +333,15 @@ abstract class ChannelIntegrationSpec extends IntegrationSpec {
324333
assert(failed.failures.head.asInstanceOf[RemoteFailure].e == DecryptedFailurePacket(nodes("C").nodeParams.nodeId, PermanentChannelFailure()))
325334
// we then generate enough blocks to confirm all delayed transactions
326335
generateBlocks(25, Some(minerAddress))
327-
// C should have 2 recv transactions: its main output and the htlc timeout
328-
// F should have 1 recv transaction: its main output
336+
val expectedTxCountC = commitmentFormat match {
337+
case _: AnchorOutputsCommitmentFormat => 2 // C should have 2 recv transactions: its main output and the htlc timeout
338+
case Transactions.DefaultCommitmentFormat => 1 // C's main output uses static_remotekey
339+
}
340+
val expectedTxCountF = 1 // F should have 1 recv transaction: its main output
329341
awaitCond({
330342
val receivedByC = listReceivedByAddress(finalAddressC, sender)
331343
val receivedByF = listReceivedByAddress(finalAddressF, sender)
332-
(receivedByF diff previouslyReceivedByF).size == 1 && (receivedByC diff previouslyReceivedByC).size == 2
344+
(receivedByF diff previouslyReceivedByF).size == expectedTxCountF && (receivedByC diff previouslyReceivedByC).size == expectedTxCountC
333345
}, max = 30 seconds, interval = 1 second)
334346
// we generate blocks to make tx confirm
335347
generateBlocks(2, Some(minerAddress))
@@ -455,9 +467,9 @@ abstract class ChannelIntegrationSpec extends IntegrationSpec {
455467
class StandardChannelIntegrationSpec extends ChannelIntegrationSpec {
456468

457469
test("start eclair nodes") {
458-
instantiateEclairNode("A", ConfigFactory.parseMap(Map("eclair.node-alias" -> "A", "eclair.channel.expiry-delta-blocks" -> 40, "eclair.channel.fulfill-safety-before-timeout-blocks" -> 12, "eclair.server.port" -> (if (useEclairSigner) 29840 else 29740), "eclair.api.port" -> (if (useEclairSigner) 28190 else 28090)).asJava).withFallback(withDefaultCommitment).withFallback(commonConfig))
470+
instantiateEclairNode("A", ConfigFactory.parseMap(Map("eclair.node-alias" -> "A", "eclair.channel.expiry-delta-blocks" -> 40, "eclair.channel.fulfill-safety-before-timeout-blocks" -> 12, "eclair.server.port" -> (if (useEclairSigner) 29840 else 29740), "eclair.api.port" -> (if (useEclairSigner) 28190 else 28090)).asJava).withFallback(withStaticRemoteKey).withFallback(commonConfig))
459471
instantiateEclairNode("C", ConfigFactory.parseMap(Map("eclair.node-alias" -> "C", "eclair.channel.expiry-delta-blocks" -> 40, "eclair.channel.fulfill-safety-before-timeout-blocks" -> 12, "eclair.server.port" -> (if (useEclairSigner) 29841 else 29741), "eclair.api.port" -> (if (useEclairSigner) 28191 else 28091)).asJava).withFallback(withAnchorOutputs).withFallback(commonConfig))
460-
instantiateEclairNode("F", ConfigFactory.parseMap(Map("eclair.node-alias" -> "F", "eclair.channel.expiry-delta-blocks" -> 40, "eclair.channel.fulfill-safety-before-timeout-blocks" -> 12, "eclair.server.port" -> (if (useEclairSigner) 29842 else 29742), "eclair.api.port" -> (if (useEclairSigner) 28192 else 28092)).asJava).withFallback(withDefaultCommitment).withFallback(commonConfig))
472+
instantiateEclairNode("F", ConfigFactory.parseMap(Map("eclair.node-alias" -> "F", "eclair.channel.expiry-delta-blocks" -> 40, "eclair.channel.fulfill-safety-before-timeout-blocks" -> 12, "eclair.server.port" -> (if (useEclairSigner) 29842 else 29742), "eclair.api.port" -> (if (useEclairSigner) 28192 else 28092)).asJava).withFallback(withStaticRemoteKey).withFallback(commonConfig))
461473
}
462474

463475
test("connect nodes") {
@@ -614,10 +626,11 @@ class StandardChannelIntegrationSpec extends ChannelIntegrationSpec {
614626
sender.expectMsg(htlcSuccess.head.txid)
615627
bitcoinClient.publishTransaction(htlcTimeout.head).pipeTo(sender.ref)
616628
sender.expectMsg(htlcTimeout.head.txid)
617-
// at this point C should have 6 recv transactions: its previous main output, F's main output and all htlc outputs (taken as punishment)
629+
// at this point C should have 5 recv transactions: F's main output and all htlc outputs (taken as punishment)
630+
// C's main output uses static_remotekey, so C doesn't need to claim it
618631
awaitCond({
619632
val receivedByC = listReceivedByAddress(finalAddressC, sender)
620-
(receivedByC diff previouslyReceivedByC).size == 6
633+
(receivedByC diff previouslyReceivedByC).size == 5
621634
}, max = 30 seconds, interval = 1 second)
622635
// we generate blocks to make txs confirm
623636
generateBlocks(2)

eclair-core/src/test/scala/fr/acinq/eclair/integration/IntegrationSpec.scala

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,16 +103,12 @@ abstract class IntegrationSpec extends TestKitBaseClass with BitcoindService wit
103103
s"eclair.features.${RouteBlinding.rfcName}" -> "optional",
104104
).asJava)
105105

106-
val withDefaultCommitment = commonFeatures.withFallback(ConfigFactory.parseMap(Map(
107-
s"eclair.features.${StaticRemoteKey.rfcName}" -> "disabled",
106+
val withStaticRemoteKey = commonFeatures.withFallback(ConfigFactory.parseMap(Map(
107+
s"eclair.features.${StaticRemoteKey.rfcName}" -> "mandatory",
108108
s"eclair.features.${AnchorOutputs.rfcName}" -> "disabled",
109109
s"eclair.features.${AnchorOutputsZeroFeeHtlcTx.rfcName}" -> "disabled",
110110
).asJava))
111111

112-
val withStaticRemoteKey = ConfigFactory.parseMap(Map(
113-
s"eclair.features.${StaticRemoteKey.rfcName}" -> "optional"
114-
).asJava).withFallback(withDefaultCommitment)
115-
116112
val withAnchorOutputs = ConfigFactory.parseMap(Map(
117113
s"eclair.features.${AnchorOutputs.rfcName}" -> "optional"
118114
).asJava).withFallback(withStaticRemoteKey)

eclair-core/src/test/scala/fr/acinq/eclair/integration/PaymentIntegrationSpec.scala

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package fr.acinq.eclair.integration
1818

19-
import akka.actor.ActorRef
2019
import akka.actor.testkit.typed.scaladsl.{TestProbe => TypedProbe}
2120
import akka.actor.typed.scaladsl.adapter._
2221
import akka.pattern.pipe
@@ -62,10 +61,10 @@ import scala.jdk.CollectionConverters._
6261
class PaymentIntegrationSpec extends IntegrationSpec {
6362

6463
test("start eclair nodes") {
65-
instantiateEclairNode("A", ConfigFactory.parseMap(Map("eclair.node-alias" -> "A", "eclair.channel.expiry-delta-blocks" -> 130, "eclair.server.port" -> 29730, "eclair.api.port" -> 28080, "eclair.channel.channel-flags.announce-channel" -> false).asJava).withFallback(withDefaultCommitment).withFallback(commonConfig)) // A's channels are private
66-
instantiateEclairNode("B", ConfigFactory.parseMap(Map("eclair.node-alias" -> "B", "eclair.channel.expiry-delta-blocks" -> 131, "eclair.server.port" -> 29731, "eclair.api.port" -> 28081, "eclair.trampoline-payments-enable" -> true, "eclair.onion-messages.relay-policy" -> "relay-all").asJava).withFallback(withDefaultCommitment).withFallback(commonConfig))
64+
instantiateEclairNode("A", ConfigFactory.parseMap(Map("eclair.node-alias" -> "A", "eclair.channel.expiry-delta-blocks" -> 130, "eclair.server.port" -> 29730, "eclair.api.port" -> 28080, "eclair.channel.channel-flags.announce-channel" -> false).asJava).withFallback(withStaticRemoteKey).withFallback(commonConfig)) // A's channels are private
65+
instantiateEclairNode("B", ConfigFactory.parseMap(Map("eclair.node-alias" -> "B", "eclair.channel.expiry-delta-blocks" -> 131, "eclair.server.port" -> 29731, "eclair.api.port" -> 28081, "eclair.trampoline-payments-enable" -> true, "eclair.onion-messages.relay-policy" -> "relay-all").asJava).withFallback(withStaticRemoteKey).withFallback(commonConfig))
6766
instantiateEclairNode("C", ConfigFactory.parseMap(Map("eclair.node-alias" -> "C", "eclair.channel.expiry-delta-blocks" -> 132, "eclair.server.port" -> 29732, "eclair.api.port" -> 28082, "eclair.trampoline-payments-enable" -> true).asJava).withFallback(withDualFunding).withFallback(commonConfig))
68-
instantiateEclairNode("D", ConfigFactory.parseMap(Map("eclair.node-alias" -> "D", "eclair.channel.expiry-delta-blocks" -> 133, "eclair.server.port" -> 29733, "eclair.api.port" -> 28083, "eclair.trampoline-payments-enable" -> true).asJava).withFallback(withDefaultCommitment).withFallback(commonConfig))
67+
instantiateEclairNode("D", ConfigFactory.parseMap(Map("eclair.node-alias" -> "D", "eclair.channel.expiry-delta-blocks" -> 133, "eclair.server.port" -> 29733, "eclair.api.port" -> 28083, "eclair.trampoline-payments-enable" -> true).asJava).withFallback(withStaticRemoteKey).withFallback(commonConfig))
6968
instantiateEclairNode("E", ConfigFactory.parseMap(Map("eclair.node-alias" -> "E", "eclair.channel.expiry-delta-blocks" -> 134, "eclair.server.port" -> 29734, "eclair.api.port" -> 28084).asJava).withFallback(withDualFunding).withFallback(commonConfig))
7069
instantiateEclairNode("F", ConfigFactory.parseMap(Map("eclair.node-alias" -> "F", "eclair.channel.expiry-delta-blocks" -> 135, "eclair.server.port" -> 29735, "eclair.api.port" -> 28085, "eclair.trampoline-payments-enable" -> true).asJava).withFallback(commonConfig))
7170
instantiateEclairNode("G", ConfigFactory.parseMap(Map("eclair.node-alias" -> "G", "eclair.channel.expiry-delta-blocks" -> 136, "eclair.server.port" -> 29736, "eclair.api.port" -> 28086, "eclair.relay.fees.public-channels.fee-base-msat" -> 1010, "eclair.relay.fees.public-channels.fee-proportional-millionths" -> 102, "eclair.trampoline-payments-enable" -> true).asJava).withFallback(commonConfig))

eclair-core/src/test/scala/fr/acinq/eclair/integration/StartupIntegrationSpec.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ import scala.jdk.CollectionConverters._
3131
class StartupIntegrationSpec extends IntegrationSpec {
3232

3333
test("no bitcoind wallet configured and one wallet loaded") {
34-
instantiateEclairNode("A", ConfigFactory.parseMap(Map("eclair.server.port" -> TestUtils.availablePort).asJava).withFallback(withDefaultCommitment).withFallback(commonConfig).withoutPath("eclair.bitcoind.wallet"))
34+
instantiateEclairNode("A", ConfigFactory.parseMap(Map("eclair.server.port" -> TestUtils.availablePort).asJava).withFallback(withStaticRemoteKey).withFallback(commonConfig).withoutPath("eclair.bitcoind.wallet"))
3535
}
3636

3737
test("no bitcoind wallet configured and two wallets loaded") {
3838
val sender = TestProbe()
3939
sender.send(bitcoincli, BitcoinReq("createwallet", ""))
4040
sender.expectMsgType[Any]
4141
val thrown = intercept[BitcoinDefaultWalletException] {
42-
instantiateEclairNode("C", ConfigFactory.parseMap(Map("eclair.server.port" -> TestUtils.availablePort).asJava).withFallback(withDefaultCommitment).withFallback(commonConfig).withoutPath("eclair.bitcoind.wallet"))
42+
instantiateEclairNode("C", ConfigFactory.parseMap(Map("eclair.server.port" -> TestUtils.availablePort).asJava).withFallback(withStaticRemoteKey).withFallback(commonConfig).withoutPath("eclair.bitcoind.wallet"))
4343
}
4444
assert(thrown == BitcoinDefaultWalletException(List(defaultWallet, "")))
4545
}
@@ -48,23 +48,23 @@ class StartupIntegrationSpec extends IntegrationSpec {
4848
val sender = TestProbe()
4949
sender.send(bitcoincli, BitcoinReq("createwallet", ""))
5050
sender.expectMsgType[Any]
51-
instantiateEclairNode("D", ConfigFactory.parseMap(Map("eclair.server.port" -> TestUtils.availablePort).asJava).withFallback(withDefaultCommitment).withFallback(commonConfig))
51+
instantiateEclairNode("D", ConfigFactory.parseMap(Map("eclair.server.port" -> TestUtils.availablePort).asJava).withFallback(withStaticRemoteKey).withFallback(commonConfig))
5252
}
5353

5454
test("explicit bitcoind wallet configured but not loaded") {
5555
val sender = TestProbe()
5656
sender.send(bitcoincli, BitcoinReq("createwallet", ""))
5757
sender.expectMsgType[Any]
5858
val thrown = intercept[BitcoinWalletNotLoadedException] {
59-
instantiateEclairNode("E", ConfigFactory.parseMap(Map("eclair.bitcoind.wallet" -> "notloaded", "eclair.server.port" -> TestUtils.availablePort).asJava).withFallback(withDefaultCommitment).withFallback(commonConfig))
59+
instantiateEclairNode("E", ConfigFactory.parseMap(Map("eclair.bitcoind.wallet" -> "notloaded", "eclair.server.port" -> TestUtils.availablePort).asJava).withFallback(withStaticRemoteKey).withFallback(commonConfig))
6060
}
6161
assert(thrown == BitcoinWalletNotLoadedException("notloaded", List(defaultWallet, "")))
6262
}
6363

6464
test("bitcoind started with wallets disabled") {
6565
restartBitcoind(startupFlags = "-disablewallet", loadWallet = false)
6666
val thrown = intercept[BitcoinWalletDisabledException] {
67-
instantiateEclairNode("F", ConfigFactory.load().getConfig("eclair").withFallback(withDefaultCommitment).withFallback(commonConfig))
67+
instantiateEclairNode("F", ConfigFactory.load().getConfig("eclair").withFallback(withStaticRemoteKey).withFallback(commonConfig))
6868
}
6969
assert(thrown == BitcoinWalletDisabledException(e = JsonRPCError(Error(-32601, "Method not found"))))
7070
}

0 commit comments

Comments
 (0)