From e0296083ca4a10781d5350e0e8dcdc9462cb0184 Mon Sep 17 00:00:00 2001 From: yyforyongyu Date: Sun, 9 Mar 2025 18:34:32 +0800 Subject: [PATCH] itest+lntest: fix flake in `coopCloseWithHTLCsWithRestart` Previously we'd restart Alice and then restart Bob, which means once Alice is shut down and started again before we shut down Bob, Bob will attempt to connect Alice since the connection is permanent, which could put the node in a weird state. We now make sure both nodes are shut down first, then bring them back online to avoid the above case. We may, however, create another test in the future to check the above case if needed. --- itest/lnd_coop_close_with_htlcs_test.go | 11 +++++++---- lntest/harness_assertion.go | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/itest/lnd_coop_close_with_htlcs_test.go b/itest/lnd_coop_close_with_htlcs_test.go index 8707fada7..27fcc4907 100644 --- a/itest/lnd_coop_close_with_htlcs_test.go +++ b/itest/lnd_coop_close_with_htlcs_test.go @@ -196,11 +196,14 @@ func coopCloseWithHTLCsWithRestart(ht *lntest.HarnessTest) { ht.AssertChannelInactive(bob, chanPoint) ht.AssertChannelInactive(alice, chanPoint) - // Now restart Alice and Bob. - ht.RestartNode(alice) - ht.RestartNode(bob) + // Shutdown both Alice and Bob. + restartAlice := ht.SuspendNode(alice) + restartBob := ht.SuspendNode(bob) - ht.AssertConnected(alice, bob) + // Once shutdown, restart and connect them. + require.NoError(ht, restartAlice()) + require.NoError(ht, restartBob()) + ht.EnsureConnected(alice, bob) // Show that both nodes still see the channel as waiting for close after // the restart. diff --git a/lntest/harness_assertion.go b/lntest/harness_assertion.go index fb5b03990..0523562b6 100644 --- a/lntest/harness_assertion.go +++ b/lntest/harness_assertion.go @@ -401,7 +401,7 @@ func (h *HarnessTest) assertChannelStatus(hn *node.HarnessNode, }, DefaultTimeout) require.NoErrorf(h, err, "%s: timeout checking for channel point: %v", - hn.Name(), cp) + hn.Name(), h.OutPointFromChannelPoint(cp)) return channel }