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.
This commit is contained in:
yyforyongyu committed 2025-03-18 20:24:34 +08:00
1 parent a067aa45ef
commit e0296083ca
2 files changed
+8 -5

No files matched your search

+7 -4
View File
@@ -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.
+1 -1
View File
@@ -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
}