From 9682aa7a786a110944cccbafdb94e92ab5280e3b Mon Sep 17 00:00:00 2001 From: yyforyongyu Date: Thu, 24 Oct 2024 20:14:15 +0800 Subject: [PATCH] itest: fix `testZeroConfChannelOpen` and `testOptionScidAlias` Use a new node instead of standby node to avoid closing the channels in the end. --- itest/lnd_zero_conf_test.go | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/itest/lnd_zero_conf_test.go b/itest/lnd_zero_conf_test.go index d63870376..e0dd74b1b 100644 --- a/itest/lnd_zero_conf_test.go +++ b/itest/lnd_zero_conf_test.go @@ -31,7 +31,11 @@ func testZeroConfChannelOpen(ht *lntest.HarnessTest) { "--protocol.anchors", } - bob := ht.Bob + bob := ht.NewNode("Bob", nil) + + // We'll give Bob some coins in order to fund the channel. + ht.FundCoins(btcutil.SatoshiPerBitcoin, bob) + carol := ht.NewNode("Carol", scidAliasArgs) ht.EnsureConnected(bob, carol) @@ -40,7 +44,7 @@ func testZeroConfChannelOpen(ht *lntest.HarnessTest) { p := lntest.OpenChannelParams{ Amt: chanAmt, } - chanPoint := ht.OpenChannel(bob, carol, p) + ht.OpenChannel(bob, carol, p) // Spin-up Dave so Carol can open a zero-conf channel to him. dave := ht.NewNode("Dave", scidAliasArgs) @@ -182,9 +186,6 @@ func testZeroConfChannelOpen(ht *lntest.HarnessTest) { ht.CompletePaymentRequests( dave, []string{eveInvoiceResp.PaymentRequest}, ) - - // Close standby node's channels. - ht.CloseChannel(bob, chanPoint) } // testOptionScidAlias checks that opening an option_scid_alias channel-type @@ -239,7 +240,11 @@ func optionScidAliasScenario(ht *lntest.HarnessTest, chantype, private bool) { "--protocol.anchors", } - bob := ht.Bob + bob := ht.NewNode("Bob", nil) + + // We'll give Bob some coins in order to fund the channel. + ht.FundCoins(btcutil.SatoshiPerBitcoin, bob) + carol := ht.NewNode("Carol", scidAliasArgs) dave := ht.NewNode("Dave", scidAliasArgs) @@ -285,21 +290,6 @@ func optionScidAliasScenario(ht *lntest.HarnessTest, chantype, private bool) { } fundingPoint2 := ht.OpenChannel(bob, carol, p) - defer func() { - // TODO(yy): remove the sleep once the following bug is fixed. - // When the payment is reported as settled by Bob, it's - // expected the commitment dance is finished and all subsequent - // states have been updated. Yet we'd receive the error `cannot - // co-op close channel with active htlcs` or `link failed to - // shutdown` if we close the channel. We need to investigate - // the order of settling the payments and updating commitments - // to understand and fix. - time.Sleep(2 * time.Second) - - // Close standby node's channels. - ht.CloseChannel(bob, fundingPoint2) - }() - // Wait until Dave receives the Bob<->Carol channel. ht.AssertTopologyChannelOpen(dave, fundingPoint2)