From 4755eff0a8c6d631bdc205c1a833b5aaaf1f4361 Mon Sep 17 00:00:00 2001 From: yyforyongyu Date: Thu, 6 Mar 2025 09:11:13 +0800 Subject: [PATCH] itest: remove `time.Sleep` before closing channels Remove an old TODO, which has been fixed with the `NoWait` flag for coop close. --- itest/lnd_funding_test.go | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/itest/lnd_funding_test.go b/itest/lnd_funding_test.go index c2704c3f4..4a984a06e 100644 --- a/itest/lnd_funding_test.go +++ b/itest/lnd_funding_test.go @@ -4,7 +4,6 @@ import ( "context" "fmt" "testing" - "time" "github.com/btcsuite/btcd/btcutil" "github.com/btcsuite/btcd/chaincfg/chainhash" @@ -559,17 +558,6 @@ func runChannelFundingInputTypes(ht *lntest.HarnessTest, alice, checkChannelBalance(carol, carolLocalBalance, 0, 0, 0) checkChannelBalance(alice, 0, carolLocalBalance, 0, 0) - // TODO(yy): remove the sleep once the following bug is fixed. - // - // We may get the error `unable to gracefully close channel - // while peer is offline (try force closing it instead): - // channel link not found`. This happens because the channel - // link hasn't been added yet but we now proceed to closing the - // channel. We may need to revisit how the channel open event - // is created and make sure the event is only sent after all - // relevant states have been updated. - time.Sleep(2 * time.Second) - // Now that we're done with the test, the channel can be closed. ht.CloseChannel(carol, chanPoint) @@ -685,14 +673,6 @@ func runExternalFundingScriptEnforced(ht *lntest.HarnessTest) { // HTLCs. ht.AssertInvoiceSettled(dave, resp.PaymentAddr) - // TODO(yy): remove the sleep once the following bug is fixed. - // When the invoice is reported settled, the commitment dance is not - // yet finished, which can cause an error when closing the channel, - // saying there's active HTLCs. We need to investigate this issue and - // reverse the order to, first finish the commitment dance, then report - // the invoice as settled. - time.Sleep(2 * time.Second) - // Next we'll try but this time with Dave (the responder) as the // initiator. This time the channel should be closed as normal. ht.CloseChannel(dave, chanPoint2) @@ -845,14 +825,6 @@ func runExternalFundingTaproot(ht *lntest.HarnessTest) { // HTLCs. ht.AssertInvoiceSettled(dave, resp.PaymentAddr) - // TODO(yy): remove the sleep once the following bug is fixed. - // When the invoice is reported settled, the commitment dance is not - // yet finished, which can cause an error when closing the channel, - // saying there's active HTLCs. We need to investigate this issue and - // reverse the order to, first finish the commitment dance, then report - // the invoice as settled. - time.Sleep(2 * time.Second) - // Next we'll try but this time with Dave (the responder) as the // initiator. This time the channel should be closed as normal. ht.CloseChannel(dave, chanPoint2)