mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-11-10 06:07:16 +01:00
multi: context.Background() -> t.Context()
Use the new feature of Go 1.24, fix linter warnings. This change was produced by: - running golangci-lint run --fix - sed 's/context.Background/t.Context/' -i `git grep -l context.Background | grep test.go` - manually fixing broken tests - itest, lntest: use ht.Context() where ht or hn is available - in HarnessNode.Stop() we keep using context.Background(), because it is called from a cleanup handler in which t.Context() is canceled already.
This commit is contained in:
@@ -2,7 +2,6 @@ package routerrpc
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/hex"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -264,7 +263,7 @@ func testQueryRoutes(t *testing.T, useMissionControl bool, useMsat bool,
|
||||
backend.MaxTotalTimelock = 1000
|
||||
}
|
||||
|
||||
resp, err := backend.QueryRoutes(context.Background(), request)
|
||||
resp, err := backend.QueryRoutes(t.Context(), request)
|
||||
|
||||
// If we're using both OutgoingChanId and OutgoingChanIds, we should get
|
||||
// an error.
|
||||
|
||||
@@ -82,7 +82,7 @@ func TestTrackPaymentsReturnsOnCancelContext(t *testing.T) {
|
||||
}
|
||||
towerMock := makeControlTowerMock()
|
||||
|
||||
streamCtx, cancelStream := context.WithCancel(context.Background())
|
||||
streamCtx, cancelStream := context.WithCancel(t.Context())
|
||||
stream := makeStreamMock(streamCtx)
|
||||
|
||||
server := &Server{
|
||||
@@ -110,7 +110,7 @@ func TestTrackPaymentsInflightUpdates(t *testing.T) {
|
||||
}
|
||||
towerMock := makeControlTowerMock()
|
||||
|
||||
streamCtx, cancelStream := context.WithCancel(context.Background())
|
||||
streamCtx, cancelStream := context.WithCancel(t.Context())
|
||||
stream := makeStreamMock(streamCtx)
|
||||
defer cancelStream()
|
||||
|
||||
@@ -172,7 +172,7 @@ func TestTrackPaymentsNoInflightUpdates(t *testing.T) {
|
||||
}
|
||||
towerMock.queue.Start()
|
||||
|
||||
streamCtx, cancelStream := context.WithCancel(context.Background())
|
||||
streamCtx, cancelStream := context.WithCancel(t.Context())
|
||||
stream := makeStreamMock(streamCtx)
|
||||
defer cancelStream()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user