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

+1 -2
View File
@@ -1,7 +1,6 @@
package itest
import (
"context"
"time"
"github.com/btcsuite/btcd/btcutil"
@@ -47,7 +46,7 @@ func testInvoiceHtlcModifierBasic(ht *lntest.HarnessTest) {
// Make sure we get an error if we try to register a second modifier and
// then try to use it (the error won't be returned on connect, only on
// the first _read_ interaction on the stream).
mod2, err := carol.RPC.Invoice.HtlcModifier(context.Background())
mod2, err := carol.RPC.Invoice.HtlcModifier(ht.Context())
require.NoError(ht, err)
_, err = mod2.Recv()
require.ErrorContains(