diff --git a/cmd/devp2p/internal/ethtest/eth66_suite.go b/cmd/devp2p/internal/ethtest/eth66_suite.go index 0681e880c..781c67e88 100644 --- a/cmd/devp2p/internal/ethtest/eth66_suite.go +++ b/cmd/devp2p/internal/ethtest/eth66_suite.go @@ -260,6 +260,7 @@ func (s *Suite) TestMaliciousHandshake_66(t *utesting.T) { t.Fatalf("could not write to connection: %v", err) } // check that the peer disconnected + //nolint:govet timeout := 20 * time.Second // Discard one hello for i := 0; i < 2; i++ { diff --git a/cmd/devp2p/internal/ethtest/eth66_suiteHelpers.go b/cmd/devp2p/internal/ethtest/eth66_suiteHelpers.go index 27b9437a9..5dd089425 100644 --- a/cmd/devp2p/internal/ethtest/eth66_suiteHelpers.go +++ b/cmd/devp2p/internal/ethtest/eth66_suiteHelpers.go @@ -171,6 +171,7 @@ func (s *Suite) testAnnounce66(t *utesting.T, sendConn, receiveConn *Conn, block } func (s *Suite) waitAnnounce66(t *utesting.T, conn *Conn, blockAnnouncement *NewBlock) { + //nolint:govet timeout := 20 * time.Second _, msg := conn.readAndServe66(s.chain, timeout) switch msg := msg.(type) { diff --git a/cmd/devp2p/internal/ethtest/suite.go b/cmd/devp2p/internal/ethtest/suite.go index 5a04285da..f6908b136 100644 --- a/cmd/devp2p/internal/ethtest/suite.go +++ b/cmd/devp2p/internal/ethtest/suite.go @@ -283,10 +283,11 @@ func (s *Suite) TestMaliciousHandshake(t *utesting.T) { for i, handshake := range handshakes { t.Logf("Testing malicious handshake %v\n", i) // Init the handshake - if err := conn.Write(handshake); err != nil { + if err = conn.Write(handshake); err != nil { t.Fatalf("could not write to connection: %v", err) } // check that the peer disconnected + //nolint:govet timeout := 20 * time.Second // Discard one hello for i := 0; i < 2; i++ { diff --git a/cmd/evm/internal/t8ntool/transition.go b/cmd/evm/internal/t8ntool/transition.go index 99a629f5b..df839007f 100644 --- a/cmd/evm/internal/t8ntool/transition.go +++ b/cmd/evm/internal/t8ntool/transition.go @@ -197,7 +197,7 @@ func Main(ctx *cli.Context) error { } defer inFile.Close() decoder := json.NewDecoder(inFile) - if err := decoder.Decode(&txsWithKeys); err != nil { + if err = decoder.Decode(&txsWithKeys); err != nil { return NewError(ErrorJson, fmt.Errorf("failed unmarshaling txs-file: %v", err)) } } else { @@ -213,9 +213,9 @@ func Main(ctx *cli.Context) error { // Iterate over all the tests, run them and aggregate the results // Run the test and aggregate the result - _, result, err := prestate.Apply(vmConfig, chainConfig, txs, ctx.Int64(RewardFlag.Name), getTracer) - if err != nil { - return err + _, result, err1 := prestate.Apply(vmConfig, chainConfig, txs, ctx.Int64(RewardFlag.Name), getTracer) + if err1 != nil { + return err1 } body, _ := rlp.EncodeToBytes(txs) // Dump the excution result diff --git a/core/headerchain_test.go b/core/headerchain_test.go index a6eafa44b..77d3d0e7e 100644 --- a/core/headerchain_test.go +++ b/core/headerchain_test.go @@ -65,7 +65,7 @@ func testInsert(t *testing.T, hc *HeaderChain, chain []*types.Header, wantStatus t.Errorf("wrong write status from InsertHeaderChain: got %v, want %v", status, wantStatus) } // Always verify that the header chain is unbroken - if err := verifyUnbrokenCanonchain(hc); err != nil { + if err = verifyUnbrokenCanonchain(hc); err != nil { t.Fatal(err) } if !errors.Is(err, wantErr) { diff --git a/core/rawdb/accessors_chain.go b/core/rawdb/accessors_chain.go index c819b7abe..84b039b2e 100644 --- a/core/rawdb/accessors_chain.go +++ b/core/rawdb/accessors_chain.go @@ -803,7 +803,7 @@ func WriteBadBlock(db ethdb.Database, block *types.Block) { } var badBlocks badBlockList if len(blob) > 0 { - if err := rlp.DecodeBytes(blob, &badBlocks); err != nil { + if err = rlp.DecodeBytes(blob, &badBlocks); err != nil { log.Crit("Failed to decode old bad blocks", "error", err) } } diff --git a/core/tx_pool.go b/core/tx_pool.go index d0f42b038..9421f39b9 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -614,7 +614,7 @@ func (pool *TxPool) add(tx *types.Transaction, local bool) (replaced bool, err e // If the transaction fails basic validation, discard it if pool.currentState != nil { - if err := pool.validateTx(tx, isLocal); err != nil { + if err = pool.validateTx(tx, isLocal); err != nil { log.Trace("Discarding invalid transaction", "hash", hash, "err", err) invalidTxMeter.Mark(1) return false, err diff --git a/core/types/transaction.go b/core/types/transaction.go index 2d4673b18..e24bbd2a1 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -122,7 +122,7 @@ func (tx *Transaction) DecodeRLP(s *rlp.Stream) error { case kind == rlp.List: // It's a legacy transaction. var inner LegacyTx - err := s.Decode(&inner) + err = s.Decode(&inner) if err == nil { tx.setDecoded(&inner, int(rlp.ListSize(size))) }