mirror of
https://github.com/lightningnetwork/lnd.git
synced 2026-08-13 12:32:48 +02:00
lint: remove redundant loop var copies in test files
Since Go 1.22 loop variables are scoped per-iteration, so the `x := x` / `a, b := a, b` copies inside range/for loops are no longer needed. This removes the existing redundant copies in test files.
This commit is contained in:
parent
3e39a4dbe8
commit
aca27e27f5
137 changed files with 0 additions and 271 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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{
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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{
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -155,7 +155,6 @@ func TestMigrateHtlcAttempts(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, test := range tests {
|
||||
test := test
|
||||
|
||||
migtest.ApplyMigration(
|
||||
t,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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(),
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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{
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -123,7 +123,6 @@ func TestMaybeMatchScript(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, test := range tests {
|
||||
test := test
|
||||
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
|
@ -361,7 +360,6 @@ func TestMaxFeeClamp(t *testing.T) {
|
|||
},
|
||||
}
|
||||
for _, test := range tests {
|
||||
test := test
|
||||
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
|
@ -398,7 +396,6 @@ func TestMaxFeeBailOut(t *testing.T) {
|
|||
)
|
||||
|
||||
for _, isInitiator := range []bool{true, false} {
|
||||
isInitiator := isInitiator
|
||||
|
||||
t.Run(fmt.Sprintf("initiator=%v", isInitiator), func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
|
@ -494,7 +491,6 @@ func TestParseUpfrontShutdownAddress(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
tc := tc
|
||||
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
|
|
|||
|
|
@ -123,7 +123,6 @@ func TestCalculateFees(t *testing.T) {
|
|||
fundingOutputEstimate.AddP2WSHOutput()
|
||||
|
||||
for _, test := range testCases {
|
||||
test := test
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
feeNoChange, feeWithChange, err := calculateFees(
|
||||
test.utxos, feeRate, fundingOutputEstimate,
|
||||
|
|
@ -309,7 +308,6 @@ func TestCoinSelect(t *testing.T) {
|
|||
fundingOutputEstimate.AddP2WSHOutput()
|
||||
|
||||
for _, test := range testCases {
|
||||
test := test
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
|
@ -451,7 +449,6 @@ func TestCalculateChangeAmount(t *testing.T) {
|
|||
}}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(tt *testing.T) {
|
||||
changeAmt, needMore, err := CalculateChangeAmount(
|
||||
tc.totalInputAmt, tc.requiredAmt,
|
||||
|
|
@ -644,7 +641,6 @@ func TestCoinSelectSubtractFees(t *testing.T) {
|
|||
fundingOutputEstimate.AddP2WSHOutput()
|
||||
|
||||
for _, test := range testCases {
|
||||
test := test
|
||||
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
feeRate := feeRate
|
||||
|
|
@ -893,7 +889,6 @@ func TestCoinSelectUpToAmount(t *testing.T) {
|
|||
fundingOutputEstimate.AddP2WSHOutput()
|
||||
|
||||
for _, test := range testCases {
|
||||
test := test
|
||||
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
|
|
|||
|
|
@ -456,7 +456,6 @@ func TestPsbtVerify(t *testing.T) {
|
|||
|
||||
// Loop through all our test cases.
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
// Reset the state from a previous test and create a new
|
||||
// pending PSBT that we can manipulate.
|
||||
|
|
@ -622,7 +621,6 @@ func TestPsbtFinalize(t *testing.T) {
|
|||
|
||||
// Loop through all our test cases.
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
// Reset the state from a previous test and create a new
|
||||
// pending PSBT that we can manipulate.
|
||||
|
|
@ -739,7 +737,6 @@ func TestVerifyAllInputsSegWit(t *testing.T) {
|
|||
}}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
r := strings.NewReader(tc.packet)
|
||||
|
|
|
|||
|
|
@ -387,7 +387,6 @@ func TestSimpleAddSettleWorkflow(t *testing.T) {
|
|||
t.Parallel()
|
||||
|
||||
for _, tweakless := range []bool{true, false} {
|
||||
tweakless := tweakless
|
||||
|
||||
t.Run(fmt.Sprintf("tweakless=%v", tweakless), func(t *testing.T) {
|
||||
testAddSettleWorkflow(t, tweakless, 0, false)
|
||||
|
|
@ -8927,7 +8926,6 @@ func TestFetchParent(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, test := range tests {
|
||||
test := test
|
||||
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
// Create a lightning channel with newly initialized
|
||||
|
|
@ -9274,7 +9272,6 @@ func TestEvaluateView(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, test := range tests {
|
||||
test := test
|
||||
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
isInitiator := test.channelInitiator == lntypes.Local
|
||||
|
|
@ -10312,7 +10309,6 @@ func TestCreateBreachRetribution(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
tx := spendTx
|
||||
if tc.noSpendTx {
|
||||
|
|
@ -10741,7 +10737,6 @@ func TestApplyCommitmentFee(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
//nolint:ll
|
||||
balance, bufferAmt, commitFee, err := tc.channel.applyCommitFee(
|
||||
|
|
|
|||
|
|
@ -262,7 +262,6 @@ func TestScaleNumConfsKnownValues(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
result := ScaleNumConfs(tc.chanAmt, tc.pushAmt)
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ func TestDefaultRoutingFeeLimitForAmount(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, test := range tests {
|
||||
test := test
|
||||
|
||||
t.Run(fmt.Sprintf("%d sats", test.amount), func(t *testing.T) {
|
||||
feeLimit := DefaultRoutingFeeLimitForAmount(test.amount)
|
||||
|
|
@ -85,7 +84,6 @@ func TestDustLimitForSize(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, test := range tests {
|
||||
test := test
|
||||
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
dustlimit := DustLimitForSize(test.size)
|
||||
|
|
|
|||
|
|
@ -226,7 +226,6 @@ func TestCommitmentAndHTLCTransactions(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, set := range vectorSets {
|
||||
set := set
|
||||
|
||||
var testCases []testCase
|
||||
|
||||
|
|
@ -237,7 +236,6 @@ func TestCommitmentAndHTLCTransactions(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
|
||||
for _, test := range testCases {
|
||||
test := test
|
||||
name := fmt.Sprintf("%s-%s", set.name, test.Name)
|
||||
|
||||
t.Run(name, func(t *testing.T) {
|
||||
|
|
@ -787,7 +785,6 @@ func TestCommitmentSpendValidation(t *testing.T) {
|
|||
// but we also need to support older nodes that want to open channels
|
||||
// with the legacy format, so we'll test spending in both scenarios.
|
||||
for _, tweakless := range []bool{true, false} {
|
||||
tweakless := tweakless
|
||||
t.Run(fmt.Sprintf("tweak=%v", tweakless), func(t *testing.T) {
|
||||
testSpendValidation(t, tweakless)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ func TestDecodeAcceptChannel(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, test := range tests {
|
||||
test := test
|
||||
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
priv, err := btcec.NewPrivateKey()
|
||||
|
|
|
|||
|
|
@ -340,7 +340,6 @@ func TestFeatures(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, test := range tests {
|
||||
test := test
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
fv := NewFeatureVector(
|
||||
toRawFV(test.exp), Features,
|
||||
|
|
@ -508,7 +507,6 @@ func TestValidateUpdate(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, testCase := range testCases {
|
||||
testCase := testCase
|
||||
|
||||
t.Run(testCase.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
|
|
|||
|
|
@ -78,7 +78,6 @@ func TestLocalNoncesDataEncodeDecodeValue(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, test := range tests {
|
||||
test := test
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
|
@ -181,7 +180,6 @@ func TestLocalNoncesDataDecodeFailuresValue(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, test := range tests {
|
||||
test := test
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
|
|
|||
|
|
@ -93,7 +93,6 @@ func TestEncodeDecodeTlv(t *testing.T) {
|
|||
t.Parallel()
|
||||
|
||||
for _, testFailure := range onionFailures {
|
||||
testFailure := testFailure
|
||||
code := testFailure.Code().String()
|
||||
|
||||
t.Run(code, func(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ func TestPingDecodeAllowsNoReplyPongSizes(t *testing.T) {
|
|||
testCases := []uint16{65532, 65535}
|
||||
|
||||
for _, numPongBytes := range testCases {
|
||||
numPongBytes := numPongBytes
|
||||
testName := strconv.FormatUint(uint64(numPongBytes), 10)
|
||||
|
||||
t.Run(testName, func(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ func TestQueryChannelRange(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, test := range tests {
|
||||
test := test
|
||||
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
|
|
|||
|
|
@ -50,7 +50,6 @@ var (
|
|||
// that contains duplicate or unsorted ids returns an ErrUnsortedSIDs failure.
|
||||
func TestQueryShortChanIDsUnsorted(t *testing.T) {
|
||||
for _, test := range unsortedSidTests {
|
||||
test := test
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
req := &QueryShortChanIDs{
|
||||
EncodingType: test.encType,
|
||||
|
|
@ -96,7 +95,6 @@ func TestQueryShortChanIDsZero(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, test := range testCases {
|
||||
test := test
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
req := &QueryShortChanIDs{
|
||||
EncodingType: test.encoding,
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ import (
|
|||
// that contains duplicate or unsorted ids returns an ErrUnsortedSIDs failure.
|
||||
func TestReplyChannelRangeUnsorted(t *testing.T) {
|
||||
for _, test := range unsortedSidTests {
|
||||
test := test
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
req := &ReplyChannelRange{
|
||||
EncodingType: test.encType,
|
||||
|
|
@ -63,7 +62,6 @@ func TestReplyChannelRangeEmpty(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, test := range emptyChannelsTests {
|
||||
test := test
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
req := ReplyChannelRange{
|
||||
FirstBlockHeight: 1,
|
||||
|
|
@ -210,7 +208,6 @@ func TestReplyChannelRangeEncode(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, test := range tests {
|
||||
test := test
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
|
@ -327,7 +324,6 @@ func TestReplyChannelRangeDecode(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, test := range tests {
|
||||
test := test
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
|
|
|||
|
|
@ -273,7 +273,6 @@ func TestNewSigFromRawSignature(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
result, err := NewSigFromECDSARawSignature(tc.rawSig)
|
||||
require.Equal(t, tc.expectedErr, err)
|
||||
|
|
|
|||
|
|
@ -457,7 +457,6 @@ func TestWriteTCPAddr(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
oldLen := buf.Len()
|
||||
|
||||
|
|
@ -545,7 +544,6 @@ func TestWriteOnionAddr(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
oldLen := buf.Len()
|
||||
|
||||
|
|
@ -618,7 +616,6 @@ func TestWriteNetAddrs(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
buf := new(bytes.Buffer)
|
||||
|
||||
|
|
|
|||
|
|
@ -105,7 +105,6 @@ func TestUpdateDisableFlag(t *testing.T) {
|
|||
t.Parallel()
|
||||
|
||||
for _, tc := range updateDisableTests {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
// Create the initial update, the only fields we are
|
||||
// concerned with in this test are the timestamp and the
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ func TestGlobalLimiterDisabled(t *testing.T) {
|
|||
{"both zero", 0, 0},
|
||||
}
|
||||
for _, tc := range cases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
lim := NewGlobalLimiter(tc.kbps, tc.burstBytes)
|
||||
|
|
@ -84,7 +83,6 @@ func TestPeerRateLimiterDisabled(t *testing.T) {
|
|||
{"both zero", 0, 0},
|
||||
}
|
||||
for _, tc := range cases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
p := NewPeerRateLimiter(tc.kbps, tc.burstBytes)
|
||||
|
|
@ -217,7 +215,6 @@ func TestPeerRateLimiterConcurrentAllowN(t *testing.T) {
|
|||
var wg sync.WaitGroup
|
||||
var ops atomic.Uint64
|
||||
for w := 0; w < workers; w++ {
|
||||
w := w
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
|
|
|
|||
|
|
@ -168,7 +168,6 @@ func TestDecidePaymentStatus(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
|
@ -228,7 +227,6 @@ func TestPaymentStatusActions(t *testing.T) {
|
|||
}
|
||||
|
||||
for i, tc := range testCases {
|
||||
i, tc := i, tc
|
||||
|
||||
ps := tc.status
|
||||
name := fmt.Sprintf("test_%d_%s", i, ps.String())
|
||||
|
|
|
|||
|
|
@ -783,8 +783,6 @@ func TestPaymentRegistrable(t *testing.T) {
|
|||
}
|
||||
|
||||
for i, tc := range testCases {
|
||||
i, tc := i, tc
|
||||
|
||||
p := &MPPayment{
|
||||
Status: tc.status,
|
||||
State: &MPPaymentState{
|
||||
|
|
@ -901,8 +899,6 @@ func TestPaymentSetState(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
|
@ -1034,8 +1030,6 @@ func TestNeedWaitAttempts(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
|
||||
p := &MPPayment{
|
||||
Info: &PaymentCreationInfo{
|
||||
PaymentIdentifier: [32]byte{1, 2, 3},
|
||||
|
|
@ -1212,8 +1206,6 @@ func TestAllowMoreAttempts(t *testing.T) {
|
|||
}
|
||||
|
||||
for i, tc := range testCases {
|
||||
tc := tc
|
||||
|
||||
p := &MPPayment{
|
||||
Info: &PaymentCreationInfo{
|
||||
PaymentIdentifier: [32]byte{1, 2, 3},
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue