Merge pull request #10872 from erickcestari/enable-copyloopvar-linter

lint: reactivate several disabled linters
This commit is contained in:
Yong 2026-06-11 05:23:47 +08:00 committed by GitHub
commit 21a338512c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
169 changed files with 39 additions and 360 deletions

View file

@ -46,16 +46,28 @@ linters:
# Init functions are used by loggers throughout the codebase.
- gochecknoinits
# Deprecated linters. See https://golangci-lint.run/usage/linters/.
- bodyclose
# contextcheck requires threading context.Context through many existing
# function signatures (including test harnesses), so we leave it off for
# now.
- contextcheck
- nilerr
- noctx
- rowserrcheck
- sqlclosecheck
# tparallel requires adding t.Parallel() to a large number of existing
# subtests, which can surface shared-state races. Disabled until we can
# address it carefully.
- tparallel
# unparam has a sizeable backlog of unused parameters to clean up before it
# can be enabled.
- unparam
- wastedassign
# nilerr is too noisy for our code base: most reports are intentional error
# swallowing (documented with comments) or false positives where a boolean
# check is mistaken for an error check.
- nilerr
# noctx would only flag a couple of interface methods and a test helper that
# have no context to thread through, so it adds little value for now.
- noctx
# Disable whitespace linters as it has conflict rules against our
# contribution guidelines.
@ -114,7 +126,6 @@ linters:
- testifylint
- perfsprint
- inamedparam
- copyloopvar
- tagalign
- protogetter
- revive

View file

@ -259,7 +259,6 @@ func TestGetNextScid(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
nextScid := getNextScid(test.current)
require.Equal(t, test.expected, nextScid)

View file

@ -43,7 +43,6 @@ var sharerTests = []sharerTest{
// receiver, produce identical child hashes and preimages as the sender.
func TestSharer(t *testing.T) {
for _, test := range sharerTests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()

View file

@ -40,7 +40,6 @@ func TestBetweennessCentralityEmptyGraph(t *testing.T) {
)
for _, chanGraph := range chanGraphs {
chanGraph := chanGraph
graph, err := chanGraph.genFunc(t)
require.NoError(t, err, "unable to create graph")
@ -83,7 +82,6 @@ func TestBetweennessCentralityWithNonEmptyGraph(t *testing.T) {
for _, numWorkers := range workers {
for _, chanGraph := range chanGraphs {
chanGraph := chanGraph
numWorkers := numWorkers
graph, err := chanGraph.genFunc(t)
require.NoError(t, err, "unable to create graph")
@ -110,7 +108,6 @@ func TestBetweennessCentralityWithNonEmptyGraph(t *testing.T) {
require.NoError(t1, err)
for _, expected := range tests {
expected := expected
centrality := metric.GetMetric(
expected.normalize,
)

View file

@ -91,7 +91,6 @@ func TestPrefAttachmentSelectEmptyGraph(t *testing.T) {
}
for _, chanGraph := range chanGraphs {
chanGraph := chanGraph
graph, err := chanGraph.genFunc(t)
require.NoError(t, err, "unable to create graph")
@ -128,7 +127,6 @@ func TestPrefAttachmentSelectTwoVertexes(t *testing.T) {
)
for _, chanGraph := range chanGraphs {
chanGraph := chanGraph
graph, err := chanGraph.genFunc(t)
require.NoError(t, err, "unable to create graph")
@ -215,7 +213,6 @@ func TestPrefAttachmentSelectGreedyAllocation(t *testing.T) {
)
for _, chanGraph := range chanGraphs {
chanGraph := chanGraph
graph, err := chanGraph.genFunc(t)
require.NoError(t, err, "unable to create graph")
@ -328,7 +325,6 @@ func TestPrefAttachmentSelectSkipNodes(t *testing.T) {
)
for _, chanGraph := range chanGraphs {
chanGraph := chanGraph
graph, err := chanGraph.genFunc(t)
require.NoError(t, err, "unable to create graph")

View file

@ -83,7 +83,6 @@ func TestTopCentrality(t *testing.T) {
}
for _, chanGraph := range chanGraphs {
chanGraph := chanGraph
success := t.Run(chanGraph.name, func(t1 *testing.T) {
t1.Parallel()

View file

@ -92,7 +92,6 @@ func TestParseAndSetDebugLevels(t *testing.T) {
}
for _, test := range testCases {
test := test
t.Run(test.name, func(t *testing.T) {
m := &mockSubLogger{
subLogLevels: make(map[string]string),

View file

@ -298,8 +298,6 @@ func (m *MempoolNotifier) notifySpent(spentInputs inputsWithTx) {
// Iterate the spent inputs to notify the subscribers concurrently.
for op, tx := range spentInputs {
op, tx := op, tx
m.wg.Add(1)
go notifyAll(tx, op)
}

View file

@ -172,7 +172,6 @@ func TestTxNotifierRegistrationValidation(t *testing.T) {
}
for _, testCase := range testCases {
testCase := testCase
success := t.Run(testCase.name, func(t *testing.T) {
hintCache := newMockHintCache()
n := chainntnfs.NewTxNotifier(
@ -1943,14 +1942,18 @@ func TestTxNotifierConfirmHintCache(t *testing.T) {
// the height hints should remain unchanged. This simulates blocks
// confirming while the historical dispatch is processing the
// registration.
hint, err := hintCache.QueryConfirmHint(ntfn1.HistoricalDispatch.ConfRequest)
_, err = hintCache.QueryConfirmHint(
ntfn1.HistoricalDispatch.ConfRequest,
)
if err != chainntnfs.ErrConfirmHintNotFound {
t.Fatalf("unexpected error when querying for height hint "+
"want: %v, got %v",
chainntnfs.ErrConfirmHintNotFound, err)
}
hint, err = hintCache.QueryConfirmHint(ntfn2.HistoricalDispatch.ConfRequest)
_, err = hintCache.QueryConfirmHint(
ntfn2.HistoricalDispatch.ConfRequest,
)
if err != chainntnfs.ErrConfirmHintNotFound {
t.Fatalf("unexpected error when querying for height hint "+
"want: %v, got %v",
@ -1979,7 +1982,9 @@ func TestTxNotifierConfirmHintCache(t *testing.T) {
// Now that both notifications are waiting at tip for confirmations,
// they should have their height hints updated to the latest block
// height.
hint, err = hintCache.QueryConfirmHint(ntfn1.HistoricalDispatch.ConfRequest)
hint, err := hintCache.QueryConfirmHint(
ntfn1.HistoricalDispatch.ConfRequest,
)
require.NoError(t, err, "unable to query for hint")
if hint != tx1Height {
t.Fatalf("expected hint %d, got %d",

View file

@ -134,8 +134,6 @@ func (c *channelAcceptorCtx) queryAndAssert(queries map[*lnwire.OpenChannel]*Cha
)
for request, expected := range queries {
request := request
expected := expected
go func() {
resp := c.acceptor.Accept(&ChannelAcceptRequest{

View file

@ -182,7 +182,6 @@ func TestMergeResponse(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
resp, err := mergeResponse(test.current, test.new)

View file

@ -118,7 +118,6 @@ func TestValidateAcceptorResponse(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
// Create an acceptor, everything can be nil because

View file

@ -431,7 +431,6 @@ func TestCreateArchiveFile(t *testing.T) {
}
for _, tc := range tests {
tc := tc
t.Run(tc.name, func(t *testing.T) {
defer os.RemoveAll(archiveDir)
if tc.setup != nil {

View file

@ -388,7 +388,6 @@ func TestGetOnlinePeriod(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()
@ -545,7 +544,6 @@ func TestUptime(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
score := &peerLog{

View file

@ -57,7 +57,6 @@ func TestStartStoreError(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
clock := clock.NewTestClock(testNow)

View file

@ -39,7 +39,6 @@ func TestGetRateLimit(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()
@ -91,7 +90,6 @@ func TestCooldownFlapCount(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()

View file

@ -566,7 +566,6 @@ func TestOptionalShutdown(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
fullDB, err := MakeTestDB(t)
@ -1325,7 +1324,6 @@ func TestShutdownInfo(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()
@ -1513,7 +1511,6 @@ func TestCloseInitiator(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()
@ -1634,7 +1631,6 @@ func TestHasChanStatus(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
c := &OpenChannel{
@ -1817,7 +1813,6 @@ func TestHTLCsExtraData(t *testing.T) {
}
for _, testCase := range testCases {
testCase := testCase
t.Run(testCase.name, func(t *testing.T) {
t.Parallel()

View file

@ -594,7 +594,6 @@ func TestFetchChannels(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()

View file

@ -91,7 +91,6 @@ func (c *HeightHintCache) CommitSpendHint(height uint32,
}
for _, spendRequest := range spendRequests {
spendRequest := spendRequest
spendHintKey, err := spendHintKey(&spendRequest)
if err != nil {
return err
@ -161,7 +160,6 @@ func (c *HeightHintCache) PurgeSpendHint(
}
for _, spendRequest := range spendRequests {
spendRequest := spendRequest
spendHintKey, err := spendHintKey(&spendRequest)
if err != nil {
return err
@ -198,7 +196,6 @@ func (c *HeightHintCache) CommitConfirmHint(height uint32,
}
for _, confRequest := range confRequests {
confRequest := confRequest
confHintKey, err := confHintKey(&confRequest)
if err != nil {
return err
@ -269,7 +266,6 @@ func (c *HeightHintCache) PurgeConfirmHint(
}
for _, confRequest := range confRequests {
confRequest := confRequest
confHintKey, err := confHintKey(&confRequest)
if err != nil {
return err

View file

@ -938,7 +938,6 @@ func (k *kvInvoiceUpdater) storeAddHtlcsUpdate() error {
// As we don't update the settle index above for AMP invoices, we'll do
// it here for each sub-AMP invoice that was settled.
for settledSetID := range k.settledSetIDs {
settledSetID := settledSetID
err := k.setSettleMetaFields(&settledSetID)
if err != nil {
return err
@ -1862,7 +1861,6 @@ func ampStateEncoder(w io.Writer, val interface{}, buf *[8]byte) error {
// inner length prefix.
for setID, ampState := range *v {
setID := [32]byte(setID)
ampState := ampState
htlcState := uint8(ampState.State)
settleDate := ampState.SettleDate

View file

@ -547,7 +547,7 @@ func TestApplyOptionalVersions(t *testing.T) {
require.Equal(t, 0, migrateCount, "expected no migration")
// Check the optional meta is not updated.
om, err := db.fetchOptionalMeta()
_, err = db.fetchOptionalMeta()
require.NoError(t, err, "error getting optional meta")
// Enable all optional migrations.
@ -563,7 +563,7 @@ func TestApplyOptionalVersions(t *testing.T) {
)
// Fetch the updated optional meta.
om, err = db.fetchOptionalMeta()
om, err := db.fetchOptionalMeta()
require.NoError(t, err, "error getting optional meta")
// Verify that the optional meta is updated as expected.

View file

@ -37,7 +37,6 @@ func TestCreateTLB(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
migtest.ApplyMigration(
t,

View file

@ -192,7 +192,6 @@ func genAfterMigration(afterBytes []byte) func(kvdb.RwTx) error {
// final struct, but verifies that the field is properly removed.
func TestTLVInvoiceMigration(t *testing.T) {
for _, test := range migrationTests {
test := test
t.Run(test.name, func(t *testing.T) {
migtest.ApplyMigration(
t,

View file

@ -105,7 +105,6 @@ func TestMigrateSequenceIndex(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
// Before the migration we have a payments bucket.

View file

@ -155,7 +155,6 @@ func TestMigrateHtlcAttempts(t *testing.T) {
}
for _, test := range tests {
test := test
migtest.ApplyMigration(
t,

View file

@ -229,7 +229,6 @@ func TestMigrateInitialBalances(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
migtest.ApplyMigration(
t,

View file

@ -85,7 +85,6 @@ func TestMigrateBalancesToTlvRecords(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
// Before running the test, set the balance fields based on the
// test params.

View file

@ -97,7 +97,6 @@ func TestMigrateHistoricalBalances(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
// testChannel is used to test the balance fields are correctly
// set.

View file

@ -123,7 +123,6 @@ func TestLocateChanBucket(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
err := testLocator(tc.locator)
require.Equal(t, tc.expectedErr, err)
@ -283,7 +282,6 @@ func TestFindNextMigrateHeight(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
// Create a test channel.
c := createTestChannel(nil)
@ -658,7 +656,6 @@ func TestLocalNextUpdateNum(t *testing.T) {
cdb, err := migtest.MakeDB(t)
require.NoError(t, err)
tc := tc
t.Run(tc.name, func(t *testing.T) {
// Setup the test case.
c, height := tc.setup(cdb)

View file

@ -78,7 +78,6 @@ func TestMigrateRevocationLog(t *testing.T) {
fmt.Printf("withAmtData is set to: %v\n", withAmtData)
for i, tc := range testCases {
tc := tc
// Construct a test case name that can be easily traced.
name := fmt.Sprintf("case_%d", i)
@ -169,7 +168,6 @@ func TestValidateMigration(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
// Create a test db.
cdb, err := migtest.MakeDB(t)

View file

@ -186,8 +186,6 @@ func TestMigrateWaitingProofStore(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()

View file

@ -46,7 +46,6 @@ func TestPersistReport(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
db, err := MakeTestDB(t)
@ -193,7 +192,6 @@ func TestFetchChannelWriteBucket(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
db, err := MakeTestDB(t)

View file

@ -341,7 +341,6 @@ func TestSerializeAndDeserializeRevLog(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()
@ -586,7 +585,6 @@ func TestPutRevocationLog(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
fullDB, err := MakeTestDB(t)
require.NoError(t, err)
@ -686,7 +684,6 @@ func TestFetchRevocationLogCompatible(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
fullDB, err := MakeTestDB(t)
require.NoError(t, err)

View file

@ -129,8 +129,6 @@ func TestWaitingProofV2RoundTrip(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()

View file

@ -769,7 +769,6 @@ func listUnspent(ctx *cli.Context) error {
cli.ShowCommandHelp(ctx, "listunspent")
return nil
}
args = args.Tail()
}
unconfirmedOnly := ctx.Bool("unconfirmed_only")

View file

@ -2013,7 +2013,6 @@ func signMessageWithAddr(ctx *cli.Context) error {
case ctx.Args().Present():
msg = []byte(args.First())
args = args.Tail()
default:
return fmt.Errorf("msg argument missing")
@ -2121,7 +2120,6 @@ func verifyMessageWithAddr(ctx *cli.Context) error {
case ctx.Args().Present():
msg = []byte(args.First())
args = args.Tail()
default:
return fmt.Errorf("msg argument missing")

View file

@ -73,7 +73,6 @@ func TestValidateOnionMsgLimiter(t *testing.T) {
},
}
for _, tc := range cases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
err := validateOnionMsgLimiter(

View file

@ -912,7 +912,6 @@ Loop:
}
for _, tx := range justiceTxs.spendSecondLevelHTLCs {
tx := tx
brarLog.Debugf("Broadcasting justice tx "+
"spending second-level HTLC output: %v",

View file

@ -1582,7 +1582,6 @@ func encodeTaprootAuxData(w io.Writer, c *ContractResolutions) error {
htlcBlobs := newAuxHtlcBlobs()
for _, htlc := range c.HtlcResolutions.IncomingHTLCs {
htlc := htlc
htlcSignDesc := htlc.SweepSignDesc
ctrlBlock := htlcSignDesc.ControlBlock
@ -1619,7 +1618,6 @@ func encodeTaprootAuxData(w io.Writer, c *ContractResolutions) error {
})
}
for _, htlc := range c.HtlcResolutions.OutgoingHTLCs {
htlc := htlc
htlcSignDesc := htlc.SweepSignDesc
ctrlBlock := htlcSignDesc.ControlBlock

View file

@ -1359,7 +1359,6 @@ func (c *ChainArbitrator) loadOpenChannels() error {
// ChannelArbitrator.
for _, channel := range openChannels {
chanPoint := channel.FundingOutpoint
channel := channel
// First, we'll create an active chainWatcher for this channel
// to ensure that we detect any relevant on chain events.

View file

@ -132,7 +132,6 @@ func TestChainWatcherCoopCloseScaledConfirmationsWithReorg(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()

View file

@ -499,7 +499,6 @@ func TestChainWatcherDataLossProtect(t *testing.T) {
testName := fmt.Sprintf("num_updates=%v,broadcast_state_num=%v",
testCase.NumUpdates, testCase.BroadcastStateNum)
testCase := testCase
t.Run(testName, func(t *testing.T) {
t.Parallel()
@ -724,7 +723,6 @@ func TestChainWatcherLocalForceCloseDetect(t *testing.T) {
testCase.localOutputOnly,
)
testCase := testCase
t.Run(testName, func(t *testing.T) {
t.Parallel()

View file

@ -615,7 +615,6 @@ func maybeAugmentTaprootResolvers(chanType channeldb.ChannelType,
//nolint:ll
htlcResolutions := contractResolutions.HtlcResolutions.OutgoingHTLCs
for _, htlcRes := range htlcResolutions {
htlcRes := htlcRes
if r.htlcResolution.ClaimOutpoint ==
htlcRes.ClaimOutpoint {
@ -628,7 +627,6 @@ func maybeAugmentTaprootResolvers(chanType channeldb.ChannelType,
//nolint:ll
htlcResolutions := contractResolutions.HtlcResolutions.OutgoingHTLCs
for _, htlcRes := range htlcResolutions {
htlcRes := htlcRes
if r.htlcResolution.ClaimOutpoint ==
htlcRes.ClaimOutpoint {
@ -641,7 +639,6 @@ func maybeAugmentTaprootResolvers(chanType channeldb.ChannelType,
//nolint:ll
htlcResolutions := contractResolutions.HtlcResolutions.IncomingHTLCs
for _, htlcRes := range htlcResolutions {
htlcRes := htlcRes
if r.htlcResolution.ClaimOutpoint ==
htlcRes.ClaimOutpoint {
@ -653,7 +650,6 @@ func maybeAugmentTaprootResolvers(chanType channeldb.ChannelType,
//nolint:ll
htlcResolutions := contractResolutions.HtlcResolutions.IncomingHTLCs
for _, htlcRes := range htlcResolutions {
htlcRes := htlcRes
if r.htlcResolution.ClaimOutpoint ==
htlcRes.ClaimOutpoint {
@ -724,7 +720,6 @@ func (c *ChannelArbitrator) relaunchResolvers(commitSet *CommitSet,
// order to ensure we have complete coverage.
htlcMap := make(map[wire.OutPoint]*channeldb.HTLC)
for _, htlc := range confirmedHTLCs {
htlc := htlc
outpoint := wire.OutPoint{
Hash: commitHash,
Index: uint32(htlc.OutputIndex),
@ -2450,7 +2445,6 @@ func (c *ChannelArbitrator) prepContractResolutions(
// claim the HTLC (second-level or directly), then add the pre
case HtlcClaimAction:
for _, htlc := range htlcs {
htlc := htlc
htlcOp := wire.OutPoint{
Hash: commitHash,
@ -2481,7 +2475,6 @@ func (c *ChannelArbitrator) prepContractResolutions(
// backwards.
case HtlcTimeoutAction:
for _, htlc := range htlcs {
htlc := htlc
htlcOp := wire.OutPoint{
Hash: commitHash,
@ -2518,7 +2511,6 @@ func (c *ChannelArbitrator) prepContractResolutions(
// learn of the pre-image, or let the remote party time out.
case HtlcIncomingWatchAction:
for _, htlc := range htlcs {
htlc := htlc
htlcOp := wire.OutPoint{
Hash: commitHash,
@ -2551,7 +2543,6 @@ func (c *ChannelArbitrator) prepContractResolutions(
// backwards), or just timeout.
case HtlcOutgoingWatchAction:
for _, htlc := range htlcs {
htlc := htlc
htlcOp := wire.OutPoint{
Hash: commitHash,

View file

@ -1678,7 +1678,6 @@ func TestChannelArbitratorCommitFailure(t *testing.T) {
}
for _, test := range testCases {
test := test
log := &mockArbitratorLog{
state: StateDefault,
@ -1889,7 +1888,6 @@ func TestChannelArbitratorDanglingCommitForceClose(t *testing.T) {
}
for _, testCase := range testCases {
testCase := testCase
testName := fmt.Sprintf("testCase: htlcExpired=%v,"+
"remotePendingHTLC=%v,remotePendingCommitConf=%v",
testCase.htlcExpired, testCase.remotePendingHTLC,
@ -2214,7 +2212,6 @@ func TestRemoteCloseInitiator(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()
@ -2479,7 +2476,6 @@ func TestFindCommitmentDeadlineAndValue(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
// Mock the method `FindOutgoingHTLCDeadline`.
tc.mockFindOutgoingHTLCDeadline()
@ -3074,7 +3070,6 @@ func TestChannelArbitratorStartForceCloseFail(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()

View file

@ -348,7 +348,6 @@ func TestCommitSweepResolverDelay(t *testing.T) {
}}
for _, tc := range testCases {
tc := tc
ok := t.Run(tc.name, func(t *testing.T) {
testCommitSweepResolverDelay(t, tc.sweepErr)
})

View file

@ -1488,7 +1488,6 @@ func TestCheckSizeAndIndex(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
@ -1558,7 +1557,6 @@ func TestIsPreimageSpend(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
// Run the test.
t.Run(tc.name, func(t *testing.T) {

View file

@ -167,7 +167,6 @@ func (r *resolverCtrlBlocks) Encode(w io.Writer) error {
}
for id, ctrlBlock := range *r {
ctrlBlock := ctrlBlock
if _, err := w.Write(id[:]); err != nil {
return err
@ -486,7 +485,6 @@ func (h *htlcTapTweaks) Encode(w io.Writer) error {
}
for id, tweak := range *h {
tweak := tweak
if _, err := w.Write(id[:]); err != nil {
return err

View file

@ -687,7 +687,6 @@ func TestRejectedCribTransaction(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()
@ -1386,8 +1385,6 @@ func TestPatchZeroHeightHint(t *testing.T) {
}
for _, tc := range tests {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()

View file

@ -1457,7 +1457,6 @@ func (d *AuthenticatedGossiper) sendRemoteBatch(ctx context.Context,
}
for _, msgChunk := range annBatch {
msgChunk := msgChunk
// With the syncers taken care of, we'll merge the sender map
// with the set of syncers, so we don't send out duplicate

View file

@ -222,14 +222,12 @@ func (r *mockGraphSource) ForAllOutgoingChannels(_ context.Context,
chans := make(map[uint64]graphdb.ChannelEdge)
for _, info := range r.infos {
info := info
edgeInfo := chans[info.ChannelID]
edgeInfo.Info = &info
chans[info.ChannelID] = edgeInfo
}
for _, edges := range r.edges {
edges := edges
edge := chans[edges[0].ChannelID]
edge.Policy1 = &edges[0]

View file

@ -2296,7 +2296,6 @@ func TestGossipSyncerSyncTransitions(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()
@ -2626,7 +2625,6 @@ func TestGossipSyncerStateHandlerErrors(t *testing.T) {
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()

View file

@ -150,7 +150,6 @@ var depTests = []depTest{
// dependencies.
func TestValidateDeps(t *testing.T) {
for _, test := range depTests {
test := test
t.Run(test.name, func(t *testing.T) {
testValidateDeps(t, test)
})

View file

@ -65,7 +65,6 @@ var managerTests = []managerTest{
// including that the proper features are removed in response to config changes.
func TestManager(t *testing.T) {
for _, test := range managerTests {
test := test
t.Run(test.name, func(t *testing.T) {
testManager(t, test)
})
@ -260,7 +259,6 @@ func TestUpdateFeatureSets(t *testing.T) {
}
for _, testCase := range testCases {
testCase := testCase
t.Run(testCase.name, func(t *testing.T) {
t.Parallel()

View file

@ -301,7 +301,6 @@ func (b *Batcher) BatchFund(ctx context.Context,
// Launch a goroutine that waits for the initial response on
// either the update or error chan.
channel := channel
eg.Go(func() error {
return b.waitForUpdate(channel, true)
})
@ -415,7 +414,6 @@ func (b *Batcher) BatchFund(ctx context.Context,
for _, channel := range b.channels {
// Launch another goroutine that waits for the channel pending
// response on the update chan.
channel := channel
eg.Go(func() error {
return b.waitForUpdate(channel, false)
})

View file

@ -343,7 +343,6 @@ func TestBatchFund(t *testing.T) {
}}
for _, tc := range testCases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()

View file

@ -499,7 +499,6 @@ func TestCommitmentTypeNegotiation(t *testing.T) {
}
for _, testCase := range testCases {
testCase := testCase
ok := t.Run(testCase.name, func(t *testing.T) {
localFeatures := lnwire.NewFeatureVector(
testCase.localFeatures, lnwire.Features,

View file

@ -3609,7 +3609,6 @@ func TestFundingManagerInvalidChanReserve(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()
@ -4355,7 +4354,6 @@ func TestFundingManagerFundMax(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()
@ -4464,7 +4462,6 @@ func TestGetUpfrontShutdownScript(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
var mockPeer testNode
@ -4742,7 +4739,6 @@ func TestFundingManagerUpfrontShutdown(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
testUpfrontFailure(t, test.pkscript, test.expectErr)

View file

@ -1106,8 +1106,6 @@ func TestIsZombieChannel(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()
@ -2076,7 +2074,7 @@ func createTestGraphFromChannels(t *testing.T, useCache bool,
}
}
channelID++ //nolint:ineffassign
channelID++ //nolint:ineffassign,wastedassign
}
return &testGraphInstance{

View file

@ -252,8 +252,6 @@ func TestVersionedDBs(t *testing.T) {
// Run all v1 tests.
for _, vt := range versionedTests {
vt := vt
t.Run(vt.name+"/v1", func(t *testing.T) {
vt.test(t, lnwire.GossipVersion1)
})
@ -1954,7 +1952,6 @@ func TestGraphCacheTraversal(t *testing.T) {
// properly been reached.
numNodeChans := 0
for _, node := range nodeList {
node := node
err := graph.ForEachNodeDirectedChannel(
ctx, node.PubKeyBytes, func(d *DirectedChannel) error {
@ -4142,7 +4139,6 @@ func TestStressTestChannelGraphAPI(t *testing.T) {
)
for i := 0; i < concurrencyLevel; i++ {
i := i
t.Run(fmt.Sprintf("%d", i), func(t *testing.T) {
t.Parallel()
@ -4347,7 +4343,6 @@ func TestFilterChannelRange(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()

View file

@ -139,7 +139,6 @@ func TestForwardingAmountCalc(t *testing.T) {
}
for _, testCase := range tests {
testCase := testCase
t.Run(testCase.name, func(t *testing.T) {
t.Parallel()

View file

@ -758,7 +758,6 @@ func TestValidateBlindedRouteData(t *testing.T) {
}
for _, testCase := range tests {
testCase := testCase
t.Run(testCase.name, func(t *testing.T) {
err := hop.ValidateBlindedRouteData(

View file

@ -922,7 +922,6 @@ func TestChannelLinkCancelFullCommitment(t *testing.T) {
// Now, settle all htlcs held by bob and clear the commitment of htlcs.
for _, preimage := range preimages {
preimage := preimage
// It's possible that the HTLCs have not been delivered to the
// invoice registry at this point, so we poll until we are able

View file

@ -441,7 +441,6 @@ func TestSwitchForwardMapping(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()
testSwitchForwardMapping(
@ -661,7 +660,6 @@ func TestSwitchSendHTLCMapping(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()
testSwitchSendHtlcMapping(
@ -1917,7 +1915,6 @@ func TestCircularForwards(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()
@ -2099,7 +2096,6 @@ func TestCheckCircularForward(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()
@ -2183,7 +2179,6 @@ func TestSkipIneligibleLinksMultiHopForward(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
testSkipIneligibleLinksMultiHopForward(t, &test)
})
@ -3371,7 +3366,6 @@ func TestHtlcNotifier(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
testHtcNotifier(
@ -4864,7 +4858,6 @@ func TestSwitchForwardFailAlias(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
testSwitchForwardFailAlias(t, test.zeroConf)
@ -5074,7 +5067,6 @@ func TestSwitchAliasFailAdd(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
testSwitchAliasFailAdd(
@ -5263,7 +5255,6 @@ func TestSwitchHandlePacketForward(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
testSwitchHandlePacketForward(
@ -5420,7 +5411,6 @@ func TestSwitchAliasInterceptFail(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
testSwitchAliasInterceptFail(t, test.zeroConf)

View file

@ -178,7 +178,6 @@ func TestMuSig2CombineKeys(t *testing.T) {
}}
for _, tc := range testCases {
tc := tc
t.Run(tc.name, func(tt *testing.T) {
tt.Parallel()

View file

@ -1579,7 +1579,6 @@ var witnessSizeTests = []witnessSizeTest{
// aren't under estimating or our transactions could get stuck.
func TestWitnessSizes(t *testing.T) {
for _, test := range witnessSizeTests {
test := test
t.Run(test.name, func(t *testing.T) {
size := test.genWitness(t).SerializeSize()
if size != test.expSize {
@ -1793,7 +1792,6 @@ var txSizeTests = []txSizeTest{
// TestTxSizes asserts the correctness of our magic tx size constants.
func TestTxSizes(t *testing.T) {
for _, test := range txSizeTests {
test := test
t.Run(test.name, func(t *testing.T) {
tx := test.genTx(t)

View file

@ -388,8 +388,6 @@ func testTaprootSenderHtlcSpend(t *testing.T, auxLeaf AuxTapLeaf,
}
for i, testCase := range testCases {
i := i
testCase := testCase
spendTxCopy := spendTx.Copy()
@ -883,8 +881,6 @@ func testTaprootReceiverHtlcSpend(t *testing.T, auxLeaf AuxTapLeaf,
},
}
for i, testCase := range testCases {
i := i
testCase := testCase
spendTxCopy := spendTx.Copy()
t.Run(testCase.name, func(t *testing.T) {
@ -1225,8 +1221,6 @@ func testTaprootCommitScriptToSelf(t *testing.T, auxLeaf AuxTapLeaf,
}
for i, testCase := range testCases {
i := i
testCase := testCase
spendTxCopy := spendTx.Copy()
t.Run(testCase.name, func(t *testing.T) {
@ -1439,8 +1433,6 @@ func testTaprootCommitScriptRemote(t *testing.T, auxLeaf AuxTapLeaf,
}
for i, testCase := range testCases {
i := i
testCase := testCase
spendTxCopy := spendTx.Copy()
t.Run(testCase.name, func(t *testing.T) {
@ -1695,8 +1687,6 @@ func TestTaprootAnchorScript(t *testing.T) {
}
for i, testCase := range testCases {
i := i
testCase := testCase
spendTxCopy := spendTx.Copy()
t.Run(testCase.name, func(t *testing.T) {
@ -1984,8 +1974,6 @@ func testTaprootSecondLevelHtlcScript(t *testing.T, auxLeaf AuxTapLeaf,
}
for i, testCase := range testCases {
i := i
testCase := testCase
spendTxCopy := spendTx.Copy()
t.Run(testCase.name, func(t *testing.T) {

View file

@ -1048,7 +1048,6 @@ func testMultiPartySign(t *testing.T, taprootTweak []byte,
// signer.
var wg sync.WaitGroup
for i, signCtx := range signers {
signCtx := signCtx
wg.Add(1)
go func(idx int, signer *Session) {

View file

@ -196,7 +196,6 @@ func (i *InvoiceRegistry) scanInvoicesOnStart(ctx context.Context) error {
var pending []invoiceExpiry
for paymentHash, invoice := range pendingInvoices {
invoice := invoice
expiryRef := makeInvoiceExpiry(paymentHash, &invoice)
if expiryRef != nil {
pending = append(pending, expiryRef)
@ -509,7 +508,6 @@ func (i *InvoiceRegistry) deliverBacklogEvents(ctx context.Context,
for _, addEvent := range addEvents {
// We re-bind the loop variable to ensure we don't hold onto
// the loop reference causing is to point to the same item.
addEvent := addEvent
select {
case client.ntfnQueue.ChanIn() <- &invoiceEvent{
@ -523,7 +521,6 @@ func (i *InvoiceRegistry) deliverBacklogEvents(ctx context.Context,
for _, settleEvent := range settleEvents {
// We re-bind the loop variable to ensure we don't hold onto
// the loop reference causing is to point to the same item.
settleEvent := settleEvent
select {
case client.ntfnQueue.ChanIn() <- &invoiceEvent{

View file

@ -159,7 +159,6 @@ func TestInvoiceRegistry(t *testing.T) {
}
for _, test := range testList {
test := test
t.Run(test.name+"_KV", func(t *testing.T) {
test.test(t, makeKeyValueDB)
@ -1924,7 +1923,6 @@ func testSpontaneousAmpPayment(t *testing.T,
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
testSpontaneousAmpPaymentImpl(
t, test.ampEnabled, test.failReconstruction,

View file

@ -261,7 +261,6 @@ func TestInvoices(t *testing.T) {
}
for _, test := range testList {
test := test
t.Run(test.name+"_KV", func(t *testing.T) {
test.test(t, makeKeyValueDB)
})
@ -340,7 +339,6 @@ func testInvoiceWorkflow(t *testing.T,
t.Parallel()
for _, test := range invWorkflowTests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()
testInvoiceWorkflowImpl(t, test, makeDB)
@ -2618,7 +2616,6 @@ func testUpdateHTLCPreimages(t *testing.T,
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()
testUpdateHTLCPreimagesImpl(t, test, makeDB)
@ -2816,7 +2813,7 @@ func testDeleteCanceledInvoices(t *testing.T,
// Cancel every second invoice.
if i%2 == 0 {
invoice, err = db.UpdateInvoice(
_, err = db.UpdateInvoice(
ctxb, invpkg.InvoiceRefByHash(paymentHash), nil,
updateFunc,
)

View file

@ -134,7 +134,6 @@ func TestMigrationWithChannelDB(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
var kvStore *channeldb.DB

View file

@ -744,7 +744,6 @@ func TestUpdateHTLC(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
testUpdateHTLC(t, test, testNow)
})

View file

@ -997,7 +997,7 @@ func runChannelForceClosureTestRestart(ht *lntest.HarnessTest,
sweeps = ht.AssertNumPendingSweeps(alice, 2)
commitSweep, anchorSweep := sweeps[0], sweeps[1]
if commitSweep.AmountSat < anchorSweep.AmountSat {
commitSweep, anchorSweep = anchorSweep, commitSweep
commitSweep = anchorSweep
}
// Alice's sweeping transaction should now be broadcast. So we fetch the

View file

@ -157,7 +157,6 @@ func testCoopCloseRbf(ht *lntest.HarnessTest) {
}
for _, chanType := range channelTypes {
chanType := chanType
ht.Run(chanType.name, func(t1 *testing.T) {
st := ht.Subtest(t1)
// Set the fee estimate to 1sat/vbyte. This ensures that

View file

@ -72,7 +72,6 @@ func testCoopCloseWithHtlcs(ht *lntest.HarnessTest) {
testCases := createFlagCombos()
for _, testCase := range testCases {
testCase := testCase // Capture range variable.
ht.Run(testCase.testName, func(t *testing.T) {
tt := ht.Subtest(t)
@ -94,7 +93,6 @@ func testCoopCloseWithHtlcsWithRestart(ht *lntest.HarnessTest) {
testCases := createFlagCombos()
for _, testCase := range testCases {
testCase := testCase // Capture range variable.
ht.Run(testCase.testName, func(t *testing.T) {
tt := ht.Subtest(t)

View file

@ -47,7 +47,6 @@ func testEtcdFailover(ht *lntest.HarnessTest) {
}}
for _, test := range testCases {
test := test
success := ht.Run(test.name, func(t1 *testing.T) {
st := ht.Subtest(t1)

View file

@ -43,7 +43,6 @@ func testDeleteForwardingHistory(ht *lntest.HarnessTest) {
}
for _, tc := range testCases {
tc := tc
success := ht.Run(tc.name, func(t *testing.T) {
st := ht.Subtest(t)
tc.test(st)

View file

@ -391,7 +391,6 @@ func testMacaroonAuthentication(ht *lntest.HarnessTest) {
}}
for _, tc := range testCases {
tc := tc
ht.Run(tc.name, func(tt *testing.T) {
ctxt, cancel := context.WithTimeout(
ht.Context(), defaultTimeout,
@ -607,7 +606,6 @@ func testBakeMacaroon(ht *lntest.HarnessTest) {
}}
for _, tc := range testCases {
tc := tc
ht.Run(tc.name, func(tt *testing.T) {
ctxt, cancel := context.WithTimeout(
ht.Context(), defaultTimeout,

View file

@ -62,7 +62,6 @@ func testNonstdSweep(ht *lntest.HarnessTest) {
}
for _, test := range tests {
test := test
success := ht.Run(test.name, func(t *testing.T) {
st := ht.Subtest(t)

View file

@ -1920,7 +1920,7 @@ func testPsbtChanFundingWithUnstableUtxos(ht *lntest.HarnessTest) {
// Consume the "channel pending" update. This waits until the funding
// transaction was fully compiled.
updateResp = ht.ReceiveOpenChannelUpdate(chanUpdates)
upd, ok = updateResp.Update.(*lnrpc.OpenStatusUpdate_ChanPending)
_, ok = updateResp.Update.(*lnrpc.OpenStatusUpdate_ChanPending)
require.True(ht, ok)
err = finalTx.Deserialize(bytes.NewReader(finalizeRes.RawFinalTx))

View file

@ -221,14 +221,12 @@ func testRestAPI(ht *lntest.HarnessTest) {
alice := ht.NewNodeWithCoins("Alice", args)
for _, tc := range testCases {
tc := tc
ht.Run(tc.name, func(t *testing.T) {
tc.run(t, alice, bob)
})
}
for _, tc := range wsTestCases {
tc := tc
ht.Run(tc.name, func(t *testing.T) {
st := ht.Subtest(t)
tc.run(st)

View file

@ -205,7 +205,6 @@ func middlewareRegistrationRestrictionTests(t *testing.T,
}}
for idx, tc := range testCases {
tc := tc
t.Run(fmt.Sprintf("%d", idx), func(tt *testing.T) {
invalidName := registerMiddleware(

View file

@ -128,7 +128,6 @@ func TestLightningNetworkDaemon(t *testing.T) {
// Run the subset of the test cases selected in this tranche.
for idx, testCase := range testCases {
testCase := testCase
name := fmt.Sprintf("tranche%02d/%02d-of-%d/%s/%s",
trancheIndex, trancheOffset+uint(idx)+1,
len(allTestCases), harnessTest.ChainBackendName(),

View file

@ -646,7 +646,6 @@ func testWalletImportPubKey(ht *lntest.HarnessTest) {
}
for _, tc := range testCases {
tc := tc
success := ht.Run(tc.name, func(tt *testing.T) {
testFunc := func(ht *lntest.HarnessTest) {
testWalletImportPubKeyScenario(

View file

@ -281,7 +281,6 @@ func testOptionScidAlias(ht *lntest.HarnessTest) {
}
for _, testCase := range testCases {
testCase := testCase
success := ht.Run(testCase.name, func(t *testing.T) {
st := ht.Subtest(t)
optionScidAliasScenario(

View file

@ -345,7 +345,7 @@ func TestSecretKeyRingDerivation(t *testing.T) {
// If we attempt to query for this key, then we
// should get ErrCannotDerivePrivKey.
privKey, err = secretKeyRing.DerivePrivKey(
_, err = secretKeyRing.DerivePrivKey(
keyDesc,
)
if err != ErrCannotDerivePrivKey {

View file

@ -66,9 +66,7 @@ func TestEncryptDecryptPayload(t *testing.T) {
require.NoError(t, err)
for _, payloadCase := range payloadCases {
payloadCase := payloadCase
for _, enc := range []*Encrypter{keyRingEnc, privKeyEnc} {
enc := enc
// First, we'll encrypt the passed payload with our
// scheme.

View file

@ -270,7 +270,6 @@ func (s *Server) ImportGraph(ctx context.Context,
}
for _, rpcEdge := range graph.Edges {
rpcEdge := rpcEdge
node1, err := parsePubKey(rpcEdge.Node1Pub)
if err != nil {

View file

@ -448,7 +448,6 @@ var shouldIncludeChannelTestCases = []struct {
func TestShouldIncludeChannel(t *testing.T) {
for _, tc := range shouldIncludeChannelTestCases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
@ -514,7 +513,6 @@ var sufficientHintsTestCases = []struct {
func TestSufficientHints(t *testing.T) {
for _, tc := range sufficientHintsTestCases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
@ -881,7 +879,6 @@ func setupMockTwoChannels(h *hopHintsConfigMock) (lnwire.ChannelID,
func TestPopulateHopHints(t *testing.T) {
for _, tc := range populateHopHintsTestCases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()

View file

@ -128,7 +128,6 @@ func TestParseDuration(t *testing.T) {
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()

View file

@ -337,7 +337,6 @@ func TestUnmarshalMPP(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
testUnmarshalMPP(t, test)
})
@ -447,7 +446,6 @@ func TestUnmarshalAMP(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
testUnmarshalAMP(t, test)
})

View file

@ -2273,7 +2273,6 @@ func (w *WalletKit) handleChange(packet *psbt.Packet, changeIndex int32,
func marshallLeases(locks []*base.ListLeasedOutputResult) []*UtxoLease {
rpcLocks := make([]*UtxoLease, len(locks))
for idx, lock := range locks {
lock := lock
rpcLocks[idx] = &UtxoLease{
Id: lock.LockID[:],

View file

@ -43,8 +43,6 @@ func TestWitnessTypeMapping(t *testing.T) {
for witnessType, witnessTypeProto := range allWitnessTypes {
// Redeclare to avoid loop variables being captured
// by func literal.
witnessType := witnessType
witnessTypeProto := witnessTypeProto
t.Run(witnessType.String(), func(tt *testing.T) {
tt.Parallel()
@ -629,7 +627,6 @@ func TestFundPsbtCoinSelect(t *testing.T) {
}}
for _, tc := range testCases {
tc := tc
privKey, err := btcec.NewPrivateKey()
require.NoError(t, err)

View file

@ -55,7 +55,6 @@ func TestParseDerivationPath(t *testing.T) {
}}
for _, tc := range testCases {
tc := tc
t.Run(tc.name, func(tt *testing.T) {
result, err := parseDerivationPath(tc.path)

View file

@ -66,7 +66,6 @@ func TestCreateDir(t *testing.T) {
}
for _, tc := range tests {
tc := tc
t.Run(tc.name, func(t *testing.T) {
dir := tc.setup()
defer os.RemoveAll(dir)

View file

@ -618,7 +618,6 @@ func (b *BtcWallet) ListAccounts(name string,
return nil, err
}
for _, account := range accounts.Accounts {
account := account
res = append(res, &account.AccountProperties)
}
@ -631,7 +630,6 @@ func (b *BtcWallet) ListAccounts(name string,
return nil, err
}
for _, account := range accounts.Accounts {
account := account
res = append(res, &account.AccountProperties)
}
}
@ -644,7 +642,6 @@ func (b *BtcWallet) ListAccounts(name string,
return nil, err
}
for _, account := range accounts.Accounts {
account := account
res = append(res, &account.AccountProperties)
}
}

View file

@ -277,7 +277,6 @@ func TestSignPsbt(t *testing.T) {
}}
for _, tc := range testCases {
tc := tc
// This is the private key we're going to sign with.
privKey, err := w.deriveKeyByBIP32Path(tc.inputType.keyPath())
@ -465,7 +464,6 @@ func TestEstimateInputWeight(t *testing.T) {
input.WitnessHeaderSize
for _, tc := range testCases {
tc := tc
t.Run(tc.name, func(tt *testing.T) {
estimator := input.TxWeightEstimator{}
@ -551,7 +549,6 @@ func TestBip32DerivationFromKeyDesc(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
t.Run(tc.name, func(tt *testing.T) {
d, trD, path := Bip32DerivationFromKeyDesc(
@ -607,7 +604,6 @@ func TestBip32DerivationFromAddress(t *testing.T) {
w, _ := newTestWallet(t, netParams, seedBytes)
for _, tc := range testCases {
tc := tc
addr, err := w.NewAddress(
tc.addrType, false, lnwallet.DefaultAccountName,

View file

@ -188,7 +188,6 @@ func TestBip32KeyDerivation(t *testing.T) {
// Let's go through the test cases now that we know our wallet is ready.
for _, tc := range testCases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
privKey, err := w.deriveKeyByBIP32Path(tc.path)
@ -513,7 +512,6 @@ func TestMaybeTweakPrivKey(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
// Create a sign descriptor with the test tweaks.
signDesc := &input.SignDescriptor{

View file

@ -261,7 +261,6 @@ func TestWebAPIFeeEstimator(t *testing.T) {
require.NoError(t, estimator.Start(), "unable to start fee estimator")
for _, tc := range testCases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
est, err := estimator.EstimateFeePerKW(tc.target)
@ -361,7 +360,6 @@ func TestGetCachedFee(t *testing.T) {
}
for _, tc := range testCases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
cachedFee, err := estimator.getCachedFee(tc.confTarget)

View file

@ -35,7 +35,6 @@ func TestFeeFilterMedian(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
cb := func() ([]SatPerKWeight, error) {
return nil, nil

Some files were not shown because too many files have changed in this diff Show more