diff --git a/lntest/itest/lnd_test.go b/lntest/itest/lnd_test.go index dbae31ef..247144f3 100644 --- a/lntest/itest/lnd_test.go +++ b/lntest/itest/lnd_test.go @@ -594,7 +594,13 @@ func assertNumConnections(t *harnessTest, alice, bob *lntest.HarnessNode, // occur. func shutdownAndAssert(net *lntest.NetworkHarness, t *harnessTest, node *lntest.HarnessNode) { - if err := net.ShutdownNode(node); err != nil { + + // The process may not be in a state to always shutdown immediately, so + // we'll retry up to a hard limit to ensure we eventually shutdown. + err := wait.NoError(func() error { + return net.ShutdownNode(node) + }, defaultTimeout) + if err != nil { t.Fatalf("unable to shutdown %v: %v", node.Name(), err) } } diff --git a/lntest/node.go b/lntest/node.go index 5fc6aa46..3af26bae 100644 --- a/lntest/node.go +++ b/lntest/node.go @@ -1115,7 +1115,10 @@ func (hn *HarnessNode) stop() error { // closed before a response is returned. req := lnrpc.StopRequest{} ctx := context.Background() - hn.LightningClient.StopDaemon(ctx, &req) + _, err := hn.LightningClient.StopDaemon(ctx, &req) + if err != nil { + return err + } } // Wait for lnd process and other goroutines to exit.