fix linters

This commit is contained in:
Manav Darji 2025-03-26 19:33:36 +05:30
parent 4cfa413b38
commit 1e75ff6109
No known key found for this signature in database
GPG key ID: A426F0124435F36E
14 changed files with 7 additions and 22 deletions

View file

@ -63,7 +63,6 @@ func TestEthSuite(t *testing.T) {
} }
for _, test := range suite.EthTests() { for _, test := range suite.EthTests() {
test := test
t.Run(test.Name, func(t *testing.T) { t.Run(test.Name, func(t *testing.T) {
t.Parallel() t.Parallel()

View file

@ -77,7 +77,6 @@ func TestForkChoice(t *testing.T) {
// nolint: paralleltest // nolint: paralleltest
for _, tc := range testCases { for _, tc := range testCases {
tc := tc
t.Run(tc.name, func(t *testing.T) { t.Run(tc.name, func(t *testing.T) {
res, err := mockForker.ReorgNeeded(tc.current, tc.incoming) res, err := mockForker.ReorgNeeded(tc.current, tc.incoming)
require.Equal(t, tc.want, res, tc.name) require.Equal(t, tc.want, res, tc.name)

View file

@ -141,7 +141,7 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
return &ProcessResult{ return &ProcessResult{
Receipts: receipts, Receipts: receipts,
Requests: nil, Requests: requests,
Logs: allLogs, Logs: allLogs,
GasUsed: *usedGas, GasUsed: *usedGas,
}, nil }, nil

View file

@ -1751,7 +1751,7 @@ func (p *BlobPool) Clear() {
// The transaction addition may attempt to reserve the sender addr which // The transaction addition may attempt to reserve the sender addr which
// can't happen until Clear releases the reservation lock. Clear cannot // can't happen until Clear releases the reservation lock. Clear cannot
// acquire the subpool lock until the transaction addition is completed. // acquire the subpool lock until the transaction addition is completed.
for acct, _ := range p.index { for acct := range p.index {
p.reserve(acct, false) p.reserve(acct, false)
} }
p.lookup = newLookup() p.lookup = newLookup()

View file

@ -2017,7 +2017,7 @@ func (pool *LegacyPool) Clear() {
senderAddr, _ := types.Sender(pool.signer, tx) senderAddr, _ := types.Sender(pool.signer, tx)
pool.reserve(senderAddr, false) pool.reserve(senderAddr, false)
} }
for localSender, _ := range pool.locals.accounts { for localSender := range pool.locals.accounts {
pool.reserve(localSender, false) pool.reserve(localSender, false)
} }

View file

@ -705,8 +705,6 @@ func (d *Downloader) spawnSync(fetchers []func() error) error {
d.cancelWg.Add(len(fetchers)) d.cancelWg.Add(len(fetchers))
for _, fn := range fetchers { for _, fn := range fetchers {
fn := fn
go func() { defer d.cancelWg.Done(); errc <- fn() }() go func() { defer d.cancelWg.Done(); errc <- fn() }()
} }
// Wait for the first error, then terminate the others. // Wait for the first error, then terminate the others.

View file

@ -1378,9 +1378,6 @@ func TestRemoteHeaderRequestSpan(t *testing.T) {
} }
for i, tt := range testCases { for i, tt := range testCases {
i := i
tt := tt
t.Run("", func(t *testing.T) { t.Run("", func(t *testing.T) {
from, count, span, max := calculateRequestSpan(tt.remoteHeight, tt.localHeight) from, count, span, max := calculateRequestSpan(tt.remoteHeight, tt.localHeight)
data := reqs(int(from), count, span) data := reqs(int(from), count, span)

View file

@ -491,7 +491,7 @@ func (f *BlockFetcher) loop() {
log.Trace("Fetching scheduled headers", "peer", peer, "list", hashes) log.Trace("Fetching scheduled headers", "peer", peer, "list", hashes)
// Create a closure of the fetch and schedule in on a new thread // Create a closure of the fetch and schedule in on a new thread
fetchHeader, hashes, announcedAt := f.fetching[hashes[0]].fetchHeader, hashes, f.fetching[hashes[0]].time fetchHeader, announcedAt := f.fetching[hashes[0]].fetchHeader, f.fetching[hashes[0]].time
go func(peer string) { go func(peer string) {
if f.fetchingHook != nil { if f.fetchingHook != nil {
f.fetchingHook(hashes) f.fetchingHook(hashes)

View file

@ -619,7 +619,6 @@ func testBroadcastBlock(t *testing.T, peers, bcasts int) {
done := make(chan struct{}, peers) done := make(chan struct{}, peers)
for _, ch := range blockChs { for _, ch := range blockChs {
ch := ch
go func() { go func() {
<-ch <-ch
done <- struct{}{} done <- struct{}{}

View file

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

View file

@ -33,10 +33,6 @@ func Run(args []string) int {
mappedCommands := make(map[string]cli.CommandFactory) mappedCommands := make(map[string]cli.CommandFactory)
for k, v := range commands { for k, v := range commands {
// Declare a new v to limit the scope of v to inside the block, so the anonymous function below
// can get the "current" value of v, instead of the value of last v in the loop.
// See this post: https://stackoverflow.com/questions/10116507/go-transfer-var-into-anonymous-function for more explanation
v := v
mappedCommands[k] = func() (cli.Command, error) { mappedCommands[k] = func() (cli.Command, error) {
cmd, err := v() cmd, err := v()
return cmd.(cli.Command), err return cmd.(cli.Command), err

View file

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

View file

@ -78,8 +78,6 @@ func TestRuntimeHistogramStats(t *testing.T) {
} }
for i, test := range tests { for i, test := range tests {
i, test := i, test
t.Run(fmt.Sprint(i), func(t *testing.T) { t.Run(fmt.Sprint(i), func(t *testing.T) {
s := RuntimeHistogramFromData(1.0, &test.h).Snapshot() s := RuntimeHistogramFromData(1.0, &test.h).Snapshot()

View file

@ -1442,7 +1442,9 @@ func (w *worker) generateWork(params *generateParams, witness bool) *newPayloadR
block: block, block: block,
fees: totalFees(block, work.receipts), fees: totalFees(block, work.receipts),
sidecars: work.sidecars, sidecars: work.sidecars,
witness: work.witness, stateDB: work.state,
receipts: work.receipts,
requests: requests,
} }
} }