Skip to content

Commit

Permalink
core: fix staticcheck warnings (ethereum#20323)
Browse files Browse the repository at this point in the history
  • Loading branch information
fjl authored and enriquefynn committed Feb 15, 2021
1 parent 5d53bd1 commit f5a161c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 99 deletions.
16 changes: 6 additions & 10 deletions core/blockchain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1289,14 +1289,17 @@ func TestCanonicalBlockRetrieval(t *testing.T) {
continue // busy wait for canonical hash to be written
}
if ch != block.Hash() {
t.Fatalf("unknown canonical hash, want %s, got %s", block.Hash().Hex(), ch.Hex())
t.Errorf("unknown canonical hash, want %s, got %s", block.Hash().Hex(), ch.Hex())
return
}
fb := rawdb.ReadBlock(blockchain.db, ch, block.NumberU64())
if fb == nil {
t.Fatalf("unable to retrieve block %d for canonical hash: %s", block.NumberU64(), ch.Hex())
t.Errorf("unable to retrieve block %d for canonical hash: %s", block.NumberU64(), ch.Hex())
return
}
if fb.Hash() != block.Hash() {
t.Fatalf("invalid block hash for block %d, want %s, got %s", block.NumberU64(), block.Hash().Hex(), fb.Hash().Hex())
t.Errorf("invalid block hash for block %d, want %s, got %s", block.NumberU64(), block.Hash().Hex(), fb.Hash().Hex())
return
}
return
}
Expand Down Expand Up @@ -1916,13 +1919,6 @@ func testInsertKnownChainData(t *testing.T, typ string) {
inserter func(blocks []*types.Block, receipts []types.Receipts) error
asserter func(t *testing.T, block *types.Block)
)
headers, headers2 := make([]*types.Header, 0, len(blocks)), make([]*types.Header, 0, len(blocks2))
for _, block := range blocks {
headers = append(headers, block.Header())
}
for _, block := range blocks2 {
headers2 = append(headers2, block.Header())
}
if typ == "headers" {
inserter = func(blocks []*types.Block, receipts []types.Receipts) error {
headers := make([]*types.Header, 0, len(blocks))
Expand Down
3 changes: 1 addition & 2 deletions core/chain_makers.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,7 @@ func makeBlockChain(parent *types.Block, n int, engine consensus.Engine, db ethd
}

type fakeChainReader struct {
config *params.ChainConfig
genesis *types.Block
config *params.ChainConfig
}

// Config returns the chain configuration.
Expand Down
87 changes: 0 additions & 87 deletions core/helper_test.go

This file was deleted.

0 comments on commit f5a161c

Please sign in to comment.