Skip to content

Commit e029608

Browse files
committed
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.
1 parent a067aa4 commit e029608

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

itest/lnd_coop_close_with_htlcs_test.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,14 @@ func coopCloseWithHTLCsWithRestart(ht *lntest.HarnessTest) {
196196
ht.AssertChannelInactive(bob, chanPoint)
197197
ht.AssertChannelInactive(alice, chanPoint)
198198

199-
// Now restart Alice and Bob.
200-
ht.RestartNode(alice)
201-
ht.RestartNode(bob)
202-
203-
ht.AssertConnected(alice, bob)
199+
// Shutdown both Alice and Bob.
200+
restartAlice := ht.SuspendNode(alice)
201+
restartBob := ht.SuspendNode(bob)
202+
203+
// Once shutdown, restart and connect them.
204+
require.NoError(ht, restartAlice())
205+
require.NoError(ht, restartBob())
206+
ht.EnsureConnected(alice, bob)
204207

205208
// Show that both nodes still see the channel as waiting for close after
206209
// the restart.

lntest/harness_assertion.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ func (h *HarnessTest) assertChannelStatus(hn *node.HarnessNode,
401401
}, DefaultTimeout)
402402

403403
require.NoErrorf(h, err, "%s: timeout checking for channel point: %v",
404-
hn.Name(), cp)
404+
hn.Name(), h.OutPointFromChannelPoint(cp))
405405

406406
return channel
407407
}

0 commit comments

Comments
 (0)