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:
Boris Nagaev committed 2025-08-30 14:13:44 -03:00
1 parent 6ffe257004
commit dee8ad3754
71 files changed
+361 -393

No files matched your search

+2 -2
View File
@@ -1400,7 +1400,7 @@ func testGRPCNotFound(ht *lntest.HarnessTest) {
// during a reorg. A reorg notification is produced after a reorg affects the
// block which has produced a spending notification for this registration.
func testReorgNotifications(ht *lntest.HarnessTest) {
ctxb := context.Background()
ctxb := ht.Context()
const timeout = wait.DefaultTimeout
alice := ht.NewNodeWithCoins("Alice", nil)
@@ -1599,7 +1599,7 @@ func testReorgNotifications(ht *lntest.HarnessTest) {
func testEstimateFee(ht *lntest.HarnessTest) {
alice := ht.NewNode("Alice", nil)
ctx := context.Background()
ctx := ht.Context()
testCases := []struct {
name string