From a436618e4313757ecbcd932282b1f678817cc9c0 Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Tue, 8 Dec 2020 16:46:54 +0100 Subject: [PATCH] lntest: fix linter errors for changed code --- lntest/harness.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lntest/harness.go b/lntest/harness.go index 35391bad..bf8dd450 100644 --- a/lntest/harness.go +++ b/lntest/harness.go @@ -290,7 +290,6 @@ func (n *NetworkHarness) NewNodeWithSeed(name string, extraArgs []string, return nil, nil, nil, err } - timeout := time.Duration(DefaultTimeout) ctxb := context.Background() // Create a request to generate a new aezeed. The new seed will have the @@ -299,7 +298,8 @@ func (n *NetworkHarness) NewNodeWithSeed(name string, extraArgs []string, AezeedPassphrase: password, } - ctxt, _ := context.WithTimeout(ctxb, timeout) + ctxt, cancel := context.WithTimeout(ctxb, DefaultTimeout) + defer cancel() genSeedResp, err := node.GenSeed(ctxt, genSeedReq) if err != nil { return nil, nil, nil, err @@ -457,7 +457,8 @@ func (n *NetworkHarness) EnsureConnected(ctx context.Context, a, b *HarnessNode) errConnectionRequested := errors.New("connection request in progress") tryConnect := func(a, b *HarnessNode) error { - ctxt, _ := context.WithTimeout(ctx, DefaultTimeout) + ctxt, cancel := context.WithTimeout(ctx, DefaultTimeout) + defer cancel() bInfo, err := b.GetInfo(ctxt, &lnrpc.GetInfoRequest{}) if err != nil { return err @@ -530,7 +531,8 @@ func (n *NetworkHarness) EnsureConnected(ctx context.Context, a, b *HarnessNode) // If node B is seen in the ListPeers response from node A, // then we can exit early as the connection has been fully // established. - ctxt, _ := context.WithTimeout(ctx, DefaultTimeout) + ctxt, cancel := context.WithTimeout(ctx, DefaultTimeout) + defer cancel() resp, err := b.ListPeers(ctxt, &lnrpc.ListPeersRequest{}) if err != nil { return false