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 2025-03-09 18:34:32 +08:00
parent a067aa45ef
commit e0296083ca
No known key found for this signature in database
GPG Key ID: 9BCD95C4FF296868
2 changed files with 8 additions and 5 deletions

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.

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
}