Fix lints

This commit is contained in:
Alexey Sharp 2021-03-18 08:30:14 +00:00
parent 1ff525e6a3
commit 534f38f756
8 changed files with 12 additions and 9 deletions

View File

@ -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++ {

View File

@ -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) {

View File

@ -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++ {

View File

@ -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

View File

@ -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) {

View File

@ -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)
}
}

View File

@ -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

View File

@ -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)))
}