Skip to content

Commit f71e85b

Browse files
fjlkaralabe
authored andcommitted
core: fix staticcheck warnings (#20323)
1 parent 8008c5b commit f71e85b

File tree

3 files changed

+7
-99
lines changed

3 files changed

+7
-99
lines changed

core/blockchain_test.go

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1289,14 +1289,17 @@ func TestCanonicalBlockRetrieval(t *testing.T) {
12891289
continue // busy wait for canonical hash to be written
12901290
}
12911291
if ch != block.Hash() {
1292-
t.Fatalf("unknown canonical hash, want %s, got %s", block.Hash().Hex(), ch.Hex())
1292+
t.Errorf("unknown canonical hash, want %s, got %s", block.Hash().Hex(), ch.Hex())
1293+
return
12931294
}
12941295
fb := rawdb.ReadBlock(blockchain.db, ch, block.NumberU64())
12951296
if fb == nil {
1296-
t.Fatalf("unable to retrieve block %d for canonical hash: %s", block.NumberU64(), ch.Hex())
1297+
t.Errorf("unable to retrieve block %d for canonical hash: %s", block.NumberU64(), ch.Hex())
1298+
return
12971299
}
12981300
if fb.Hash() != block.Hash() {
1299-
t.Fatalf("invalid block hash for block %d, want %s, got %s", block.NumberU64(), block.Hash().Hex(), fb.Hash().Hex())
1301+
t.Errorf("invalid block hash for block %d, want %s, got %s", block.NumberU64(), block.Hash().Hex(), fb.Hash().Hex())
1302+
return
13001303
}
13011304
return
13021305
}
@@ -1916,13 +1919,6 @@ func testInsertKnownChainData(t *testing.T, typ string) {
19161919
inserter func(blocks []*types.Block, receipts []types.Receipts) error
19171920
asserter func(t *testing.T, block *types.Block)
19181921
)
1919-
headers, headers2 := make([]*types.Header, 0, len(blocks)), make([]*types.Header, 0, len(blocks2))
1920-
for _, block := range blocks {
1921-
headers = append(headers, block.Header())
1922-
}
1923-
for _, block := range blocks2 {
1924-
headers2 = append(headers2, block.Header())
1925-
}
19261922
if typ == "headers" {
19271923
inserter = func(blocks []*types.Block, receipts []types.Receipts) error {
19281924
headers := make([]*types.Header, 0, len(blocks))

core/chain_makers.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,7 @@ func makeBlockChain(parent *types.Block, n int, engine consensus.Engine, db ethd
283283
}
284284

285285
type fakeChainReader struct {
286-
config *params.ChainConfig
287-
genesis *types.Block
286+
config *params.ChainConfig
288287
}
289288

290289
// Config returns the chain configuration.

core/helper_test.go

Lines changed: 0 additions & 87 deletions
This file was deleted.

0 commit comments

Comments
 (0)