diff --git a/core/blockchain_test.go b/core/blockchain_test.go index f837397a1d..8791100df3 100644 --- a/core/blockchain_test.go +++ b/core/blockchain_test.go @@ -2340,7 +2340,7 @@ func testInsertKnownChainData(t *testing.T, typ string, scheme string) { } } } else { - inserter = func(blocks []*types.Block, receipts []types.Receipts) error { + inserter = func(blocks []*types.Block, _ []types.Receipts) error { _, err := chain.InsertChain(blocks) return err } @@ -2514,7 +2514,7 @@ func testInsertKnownChainDataWithMerging(t *testing.T, typ string, mergeHeight i } } } else { - inserter = func(blocks []*types.Block, receipts []types.Receipts) error { + inserter = func(blocks []*types.Block, _ []types.Receipts) error { i, err := chain.InsertChain(blocks) if err != nil { return fmt.Errorf("index %d: %w", i, err) @@ -2719,7 +2719,7 @@ func testReorgToShorterRemovesCanonMappingHeaderChain(t *testing.T, scheme strin } // Benchmarks large blocks with value transfers to non-existing accounts -func benchmarkLargeNumberOfValueToNonexisting(b *testing.B, numTxs, numBlocks int, recipientFn func(uint64) common.Address, dataFn func(uint64) []byte) { +func benchmarkLargeNumberOfValueToNonexisting(b *testing.B, numTxs, numBlocks int, recipientFn func(uint64) common.Address) { var ( signer = types.HomesteadSigner{} testBankKey, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291") @@ -2782,10 +2782,7 @@ func BenchmarkBlockChain_1x1000ValueTransferToNonexisting(b *testing.B) { recipientFn := func(nonce uint64) common.Address { return common.BigToAddress(new(big.Int).SetUint64(1337 + nonce)) } - dataFn := func(nonce uint64) []byte { - return nil - } - benchmarkLargeNumberOfValueToNonexisting(b, numTxs, numBlocks, recipientFn, dataFn) + benchmarkLargeNumberOfValueToNonexisting(b, numTxs, numBlocks, recipientFn) } func BenchmarkBlockChain_1x1000ValueTransferToExisting(b *testing.B) { @@ -2799,10 +2796,7 @@ func BenchmarkBlockChain_1x1000ValueTransferToExisting(b *testing.B) { recipientFn := func(nonce uint64) common.Address { return common.BigToAddress(new(big.Int).SetUint64(1337)) } - dataFn := func(nonce uint64) []byte { - return nil - } - benchmarkLargeNumberOfValueToNonexisting(b, numTxs, numBlocks, recipientFn, dataFn) + benchmarkLargeNumberOfValueToNonexisting(b, numTxs, numBlocks, recipientFn) } func BenchmarkBlockChain_1x1000Executions(b *testing.B) { @@ -2816,10 +2810,7 @@ func BenchmarkBlockChain_1x1000Executions(b *testing.B) { recipientFn := func(nonce uint64) common.Address { return common.BigToAddress(new(big.Int).SetUint64(0xc0de)) } - dataFn := func(nonce uint64) []byte { - return nil - } - benchmarkLargeNumberOfValueToNonexisting(b, numTxs, numBlocks, recipientFn, dataFn) + benchmarkLargeNumberOfValueToNonexisting(b, numTxs, numBlocks, recipientFn) } // Tests that importing a some old blocks, where all blocks are before the diff --git a/core/vm/stack_table.go b/core/vm/stack_table.go index 10c12901af..41b00feab1 100644 --- a/core/vm/stack_table.go +++ b/core/vm/stack_table.go @@ -37,6 +37,6 @@ func maxDupStack(n int) int { func maxStack(pop, push int) int { return int(params.StackLimit) + pop - push } -func minStack(pops, push int) int { +func minStack(pops, _ /*push*/ int) int { return pops } diff --git a/crypto/ecies/ecies_test.go b/crypto/ecies/ecies_test.go index e3da71010e..1861dc1d4e 100644 --- a/crypto/ecies/ecies_test.go +++ b/crypto/ecies/ecies_test.go @@ -301,7 +301,7 @@ func testParamSelection(t *testing.T, c testCase) { params := ParamsFromCurve(c.Curve) if params == nil { t.Fatal("ParamsFromCurve returned nil") - } else if params != nil && !cmpParams(params, c.Expected) { + } else if !cmpParams(params, c.Expected) { t.Fatalf("ecies: parameters should be invalid (%s)\n", c.Name) } diff --git a/eth/catalyst/api.go b/eth/catalyst/api.go index d154d794be..b89db88448 100644 --- a/eth/catalyst/api.go +++ b/eth/catalyst/api.go @@ -657,7 +657,7 @@ func (api *ConsensusAPI) delayPayloadImport(block *types.Block) engine.PayloadSt api.remoteBlocks.put(block.Hash(), block.Header()) // Although we don't want to trigger a sync, if there is one already in - // progress, try to extend if with the current payload request to relieve + // progress, try to extend it with the current payload request to relieve // some strain from the forkchoice update. err := api.eth.Downloader().BeaconExtend(api.eth.SyncMode(), block.Header()) if err == nil { diff --git a/eth/filters/filter_system_test.go b/eth/filters/filter_system_test.go index 4a0f40cce9..8b6569d95d 100644 --- a/eth/filters/filter_system_test.go +++ b/eth/filters/filter_system_test.go @@ -190,7 +190,7 @@ func (b *testBackend) notifyPending(logs []*types.Log) { b.chainFeed.Send(core.ChainEvent{Block: blocks[0]}) } -func newTestFilterSystem(t testing.TB, db ethdb.Database, cfg Config) (*testBackend, *FilterSystem) { +func newTestFilterSystem(_ testing.TB, db ethdb.Database, cfg Config) (*testBackend, *FilterSystem) { backend := &testBackend{db: db} sys := NewFilterSystem(backend, cfg) return backend, sys diff --git a/eth/protocols/snap/handler.go b/eth/protocols/snap/handler.go index bd7ce9e715..0d61323ee8 100644 --- a/eth/protocols/snap/handler.go +++ b/eth/protocols/snap/handler.go @@ -572,6 +572,6 @@ func ServiceGetTrieNodesQuery(chain *core.BlockChain, req *GetTrieNodesPacket, s type NodeInfo struct{} // nodeInfo retrieves some `snap` protocol metadata about the running host node. -func nodeInfo(chain *core.BlockChain) *NodeInfo { +func nodeInfo(_ *core.BlockChain) *NodeInfo { return &NodeInfo{} } diff --git a/eth/protocols/snap/sync_test.go b/eth/protocols/snap/sync_test.go index f35babb731..17eb561161 100644 --- a/eth/protocols/snap/sync_test.go +++ b/eth/protocols/snap/sync_test.go @@ -254,7 +254,7 @@ func defaultAccountRequestHandler(t *testPeer, id uint64, root common.Hash, orig return nil } -func createAccountRequestResponse(t *testPeer, root common.Hash, origin common.Hash, limit common.Hash, cap uint64) (keys []common.Hash, vals [][]byte, proofs [][]byte) { +func createAccountRequestResponse(t *testPeer, _ /*root*/ common.Hash, origin common.Hash, limit common.Hash, cap uint64) (keys []common.Hash, vals [][]byte, proofs [][]byte) { var size uint64 if limit == (common.Hash{}) { limit = common.MaxHash @@ -314,7 +314,7 @@ func defaultCodeRequestHandler(t *testPeer, id uint64, hashes []common.Hash, max return nil } -func createStorageRequestResponse(t *testPeer, root common.Hash, accounts []common.Hash, origin, limit []byte, max uint64) (hashes [][]common.Hash, slots [][][]byte, proofs [][]byte) { +func createStorageRequestResponse(t *testPeer, _ /*root*/ common.Hash, accounts []common.Hash, origin, limit []byte, max uint64) (hashes [][]common.Hash, slots [][][]byte, proofs [][]byte) { var size uint64 for _, account := range accounts { // The first account might start from a different origin and end sooner @@ -382,7 +382,7 @@ func createStorageRequestResponse(t *testPeer, root common.Hash, accounts []comm // createStorageRequestResponseAlwaysProve tests a cornercase, where the peer always // supplies the proof for the last account, even if it is 'complete'. -func createStorageRequestResponseAlwaysProve(t *testPeer, root common.Hash, accounts []common.Hash, bOrigin, bLimit []byte, max uint64) (hashes [][]common.Hash, slots [][][]byte, proofs [][]byte) { +func createStorageRequestResponseAlwaysProve(t *testPeer, _ /*root*/ common.Hash, accounts []common.Hash, bOrigin, _ /*bLimit*/ []byte, max uint64) (hashes [][]common.Hash, slots [][][]byte, proofs [][]byte) { var size uint64 max = max * 3 / 4 diff --git a/eth/tracers/js/goja.go b/eth/tracers/js/goja.go index 5290d4f709..9b4238e322 100644 --- a/eth/tracers/js/goja.go +++ b/eth/tracers/js/goja.go @@ -273,7 +273,7 @@ func (t *jsTracer) OnTxEnd(receipt *types.Receipt, err error) { } // onStart implements the Tracer interface to initialize the tracing operation. -func (t *jsTracer) onStart(from common.Address, to common.Address, create bool, input []byte, gas uint64, value *big.Int) { +func (t *jsTracer) onStart(from common.Address, to common.Address, create bool, input []byte, _ /*gas*/ uint64, value *big.Int) { if t.err != nil { return } @@ -346,7 +346,7 @@ func (t *jsTracer) OnFault(pc uint64, op byte, gas, cost uint64, scope tracing.O } // onEnd is called after the call finishes to finalize the tracing. -func (t *jsTracer) onEnd(output []byte, gasUsed uint64, err error, reverted bool) { +func (t *jsTracer) onEnd(output []byte, _ /*gasUsed*/ uint64, err error, _ /*reverted*/ bool) { if t.err != nil { return } diff --git a/eth/tracers/native/call.go b/eth/tracers/native/call.go index 3b63506580..b3f110412a 100644 --- a/eth/tracers/native/call.go +++ b/eth/tracers/native/call.go @@ -138,7 +138,7 @@ func newCallTracer(ctx *tracers.Context, cfg json.RawMessage) (*tracers.Tracer, }, nil } -func newCallTracerObject(ctx *tracers.Context, cfg json.RawMessage) (*callTracer, error) { +func newCallTracerObject(_ *tracers.Context, cfg json.RawMessage) (*callTracer, error) { var config callTracerConfig if cfg != nil { if err := json.Unmarshal(cfg, &config); err != nil { @@ -204,7 +204,7 @@ func (t *callTracer) OnExit(depth int, output []byte, gasUsed uint64, err error, t.callstack[size-1].Calls = append(t.callstack[size-1].Calls, call) } -func (t *callTracer) captureEnd(output []byte, gasUsed uint64, err error, reverted bool) { +func (t *callTracer) captureEnd(output []byte, _ /*gasUsed*/ uint64, err error, reverted bool) { if len(t.callstack) != 1 { return }