itest: Shutdown final Dave node in testChanRestore
This changes the defer function in the test for channel backups to correctly close over the 'dave' variable. Without this closure, the shutdownAndAssert call would attempt to shutdown the original (non-restored) dave instead of the most recently created (restored) dave, causing a leak of a node during tests.
This commit is contained in:
parent
281c535b49
commit
d6286e9463
@ -13405,7 +13405,11 @@ func testChanRestoreScenario(t *harnessTest, net *lntest.NetworkHarness,
|
||||
if err != nil {
|
||||
t.Fatalf("unable to create new node: %v", err)
|
||||
}
|
||||
defer shutdownAndAssert(net, t, dave)
|
||||
// Defer to a closure instead of to shutdownAndAssert due to the value
|
||||
// of 'dave' changing throughout the test.
|
||||
defer func() {
|
||||
shutdownAndAssert(net, t, dave)
|
||||
}()
|
||||
carol, err := net.NewNode("carol", nil)
|
||||
if err != nil {
|
||||
t.Fatalf("unable to make new node: %v", err)
|
||||
|
Loading…
Reference in New Issue
Block a user