Skip to content

Commit b36fe48

Browse files
committed
all: cleanup tests
1 parent d10c280 commit b36fe48

35 files changed

+421
-633
lines changed

accounts/abi/bind/backends/simulated.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,11 @@ type SimulatedBackend struct {
7878
// and uses a simulated blockchain for testing purposes.
7979
// A simulated backend always uses chainID 1337.
8080
func NewSimulatedBackendWithDatabase(database ethdb.Database, alloc core.GenesisAlloc, gasLimit uint64) *SimulatedBackend {
81-
genesis := core.Genesis{Config: params.AllEthashProtocolChanges, GasLimit: gasLimit, Alloc: alloc}
82-
genesis.MustCommit(database)
81+
genesis := core.Genesis{
82+
Config: params.AllEthashProtocolChanges,
83+
GasLimit: gasLimit,
84+
Alloc: alloc,
85+
}
8386
blockchain, _ := core.NewBlockChain(database, nil, &genesis, nil, ethash.NewFaker(), vm.Config{}, nil, nil)
8487

8588
backend := &SimulatedBackend{

consensus/clique/clique_test.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,12 @@ func TestReimportMirroredState(t *testing.T) {
5353
BaseFee: big.NewInt(params.InitialBaseFee),
5454
}
5555
copy(genspec.ExtraData[extraVanity:], addr[:])
56-
genesis := genspec.MustCommit(db)
5756

5857
// Generate a batch of blocks, each properly signed
59-
chain, _ := core.NewBlockChain(db, nil, genspec, nil, engine, vm.Config{}, nil, nil)
58+
chain, _ := core.NewBlockChain(rawdb.NewMemoryDatabase(), nil, genspec, nil, engine, vm.Config{}, nil, nil)
6059
defer chain.Stop()
6160

62-
blocks, _ := core.GenerateChain(params.AllCliqueProtocolChanges, genesis, engine, db, 3, func(i int, block *core.BlockGen) {
61+
_, blocks, _ := core.GenerateChainWithGenesis(genspec, engine, 3, func(i int, block *core.BlockGen) {
6362
// The chain maker doesn't have access to a chain, so the difficulty will be
6463
// lets unset (nil). Set it here to the correct value.
6564
block.SetDifficulty(diffInTurn)
@@ -88,8 +87,6 @@ func TestReimportMirroredState(t *testing.T) {
8887
}
8988
// Insert the first two blocks and make sure the chain is valid
9089
db = rawdb.NewMemoryDatabase()
91-
genspec.MustCommit(db)
92-
9390
chain, _ = core.NewBlockChain(db, nil, genspec, nil, engine, vm.Config{}, nil, nil)
9491
defer chain.Stop()
9592

consensus/clique/snapshot_test.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -401,9 +401,6 @@ func TestClique(t *testing.T) {
401401
for j, signer := range signers {
402402
copy(genesis.ExtraData[extraVanity+j*common.AddressLength:], signer[:])
403403
}
404-
// Create a pristine blockchain with the genesis injected
405-
db := rawdb.NewMemoryDatabase()
406-
genesisBlock := genesis.MustCommit(db)
407404

408405
// Assemble a chain of headers from the cast votes
409406
config := *params.TestChainConfig
@@ -412,10 +409,11 @@ func TestClique(t *testing.T) {
412409
Epoch: tt.epoch,
413410
}
414411
genesis.Config = &config
415-
engine := New(config.Clique, db)
412+
413+
engine := New(config.Clique, rawdb.NewMemoryDatabase())
416414
engine.fakeDiff = true
417415

418-
blocks, _ := core.GenerateChain(&config, genesisBlock, engine, db, len(tt.votes), func(j int, gen *core.BlockGen) {
416+
_, blocks, _ := core.GenerateChainWithGenesis(genesis, engine, len(tt.votes), func(j int, gen *core.BlockGen) {
419417
// Cast the vote contained in this block
420418
gen.SetCoinbase(accounts.address(tt.votes[j].voted))
421419
if tt.votes[j].auth {
@@ -451,7 +449,7 @@ func TestClique(t *testing.T) {
451449
batches[len(batches)-1] = append(batches[len(batches)-1], block)
452450
}
453451
// Pass all the headers through clique and ensure tallying succeeds
454-
chain, err := core.NewBlockChain(db, nil, genesis, nil, engine, vm.Config{}, nil, nil)
452+
chain, err := core.NewBlockChain(rawdb.NewMemoryDatabase(), nil, genesis, nil, engine, vm.Config{}, nil, nil)
455453
if err != nil {
456454
t.Errorf("test %d: failed to create test chain: %v", i, err)
457455
continue

core/bench_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,16 +187,15 @@ func benchInsertChain(b *testing.B, disk bool, gen func(int, *BlockGen)) {
187187

188188
// Generate a chain of b.N blocks using the supplied block
189189
// generator function.
190-
gspec := Genesis{
190+
gspec := &Genesis{
191191
Config: params.TestChainConfig,
192192
Alloc: GenesisAlloc{benchRootAddr: {Balance: benchRootFunds}},
193193
}
194-
genesis := gspec.MustCommit(db)
195-
chain, _ := GenerateChain(gspec.Config, genesis, ethash.NewFaker(), db, b.N, gen)
194+
_, chain, _ := GenerateChainWithGenesis(gspec, ethash.NewFaker(), b.N, gen)
196195

197196
// Time the insertion of the new chain.
198197
// State and blocks are stored in the same DB.
199-
chainman, _ := NewBlockChain(db, nil, &gspec, nil, ethash.NewFaker(), vm.Config{}, nil, nil)
198+
chainman, _ := NewBlockChain(db, nil, gspec, nil, ethash.NewFaker(), vm.Config{}, nil, nil)
200199
defer chainman.Stop()
201200
b.ReportAllocs()
202201
b.ResetTimer()

core/block_validator_test.go

Lines changed: 38 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,15 @@ import (
3939
func TestHeaderVerification(t *testing.T) {
4040
// Create a simple chain to verify
4141
var (
42-
testdb = rawdb.NewMemoryDatabase()
43-
gspec = &Genesis{Config: params.TestChainConfig}
44-
genesis = gspec.MustCommit(testdb)
45-
blocks, _ = GenerateChain(params.TestChainConfig, genesis, ethash.NewFaker(), testdb, 8, nil)
42+
gspec = &Genesis{Config: params.TestChainConfig}
43+
_, blocks, _ = GenerateChainWithGenesis(gspec, ethash.NewFaker(), 8, nil)
4644
)
4745
headers := make([]*types.Header, len(blocks))
4846
for i, block := range blocks {
4947
headers[i] = block.Header()
5048
}
5149
// Run the header checker for blocks one-by-one, checking for both valid and invalid nonces
52-
chain, _ := NewBlockChain(testdb, nil, gspec, nil, ethash.NewFaker(), vm.Config{}, nil, nil)
50+
chain, _ := NewBlockChain(rawdb.NewMemoryDatabase(), nil, gspec, nil, ethash.NewFaker(), vm.Config{}, nil, nil)
5351
defer chain.Stop()
5452

5553
for i := 0; i < len(blocks); i++ {
@@ -89,72 +87,66 @@ func TestHeaderVerificationForMergingEthash(t *testing.T) { testHeaderVerificati
8987
// Tests the verification for eth1/2 merging, including pre-merge and post-merge
9088
func testHeaderVerificationForMerging(t *testing.T, isClique bool) {
9189
var (
92-
testdb = rawdb.NewMemoryDatabase()
90+
gspec *Genesis
9391
preBlocks []*types.Block
9492
postBlocks []*types.Block
95-
runEngine consensus.Engine
96-
genspec *Genesis
93+
engine consensus.Engine
9794
merger = consensus.NewMerger(rawdb.NewMemoryDatabase())
9895
)
9996
if isClique {
10097
var (
10198
key, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
10299
addr = crypto.PubkeyToAddress(key.PublicKey)
103-
engine = clique.New(params.AllCliqueProtocolChanges.Clique, testdb)
100+
config = *params.AllCliqueProtocolChanges
104101
)
105-
genspec = &Genesis{
106-
Config: params.AllCliqueProtocolChanges,
102+
engine = beacon.New(clique.New(params.AllCliqueProtocolChanges.Clique, rawdb.NewMemoryDatabase()))
103+
gspec = &Genesis{
104+
Config: &config,
107105
ExtraData: make([]byte, 32+common.AddressLength+crypto.SignatureLength),
108106
Alloc: map[common.Address]GenesisAccount{
109107
addr: {Balance: big.NewInt(1)},
110108
},
111109
BaseFee: big.NewInt(params.InitialBaseFee),
112110
Difficulty: new(big.Int),
113111
}
114-
copy(genspec.ExtraData[32:], addr[:])
115-
genesis := genspec.MustCommit(testdb)
112+
copy(gspec.ExtraData[32:], addr[:])
116113

117-
genEngine := beacon.New(engine)
118-
preBlocks, _ = GenerateChain(params.AllCliqueProtocolChanges, genesis, genEngine, testdb, 8, nil)
119114
td := 0
120-
for i, block := range preBlocks {
115+
gendb, blocks, _ := GenerateChainWithGenesis(gspec, engine, 8, nil)
116+
for i, block := range blocks {
121117
header := block.Header()
122118
if i > 0 {
123-
header.ParentHash = preBlocks[i-1].Hash()
119+
header.ParentHash = blocks[i-1].Hash()
124120
}
125121
header.Extra = make([]byte, 32+crypto.SignatureLength)
126122
header.Difficulty = big.NewInt(2)
127123

128-
sig, _ := crypto.Sign(genEngine.SealHash(header).Bytes(), key)
124+
sig, _ := crypto.Sign(engine.SealHash(header).Bytes(), key)
129125
copy(header.Extra[len(header.Extra)-crypto.SignatureLength:], sig)
130-
preBlocks[i] = block.WithSeal(header)
126+
blocks[i] = block.WithSeal(header)
127+
131128
// calculate td
132129
td += int(block.Difficulty().Uint64())
133130
}
134-
config := *params.AllCliqueProtocolChanges
135-
config.TerminalTotalDifficulty = big.NewInt(int64(td))
136-
postBlocks, _ = GenerateChain(&config, preBlocks[len(preBlocks)-1], genEngine, testdb, 8, nil)
137-
runEngine = beacon.New(engine)
138-
genspec.Config = &config
131+
preBlocks = blocks
132+
gspec.Config.TerminalTotalDifficulty = big.NewInt(int64(td))
133+
postBlocks, _ = GenerateChain(gspec.Config, preBlocks[len(preBlocks)-1], engine, gendb, 8, nil)
139134
} else {
140-
genspec = &Genesis{Config: params.TestChainConfig}
141-
genesis := genspec.MustCommit(testdb)
142-
genEngine := beacon.New(ethash.NewFaker())
135+
config := *params.TestChainConfig
136+
gspec = &Genesis{Config: &config}
137+
engine = beacon.New(ethash.NewFaker())
143138

144-
preBlocks, _ = GenerateChain(params.TestChainConfig, genesis, genEngine, testdb, 8, nil)
145139
td := 0
140+
gendb, blocks, _ := GenerateChainWithGenesis(gspec, engine, 8, nil)
146141
for _, block := range preBlocks {
147142
// calculate td
148143
td += int(block.Difficulty().Uint64())
149144
}
150-
config := *params.TestChainConfig
151-
config.TerminalTotalDifficulty = big.NewInt(int64(td))
152-
postBlocks, _ = GenerateChain(params.TestChainConfig, preBlocks[len(preBlocks)-1], genEngine, testdb, 8, nil)
153-
154-
runEngine = beacon.New(ethash.NewFaker())
155-
genspec.Config = &config
145+
preBlocks = blocks
146+
gspec.Config.TerminalTotalDifficulty = big.NewInt(int64(td))
147+
postBlocks, _ = GenerateChain(gspec.Config, preBlocks[len(preBlocks)-1], engine, gendb, 8, nil)
156148
}
157-
149+
// Assemble header batch
158150
preHeaders := make([]*types.Header, len(preBlocks))
159151
for i, block := range preBlocks {
160152
preHeaders[i] = block.Header()
@@ -170,12 +162,12 @@ func testHeaderVerificationForMerging(t *testing.T, isClique bool) {
170162
t.Logf("Log header after the merging %d: %v", block.NumberU64(), string(blob))
171163
}
172164
// Run the header checker for blocks one-by-one, checking for both valid and invalid nonces
173-
chain, _ := NewBlockChain(testdb, nil, genspec, nil, runEngine, vm.Config{}, nil, nil)
165+
chain, _ := NewBlockChain(rawdb.NewMemoryDatabase(), nil, gspec, nil, engine, vm.Config{}, nil, nil)
174166
defer chain.Stop()
175167

176168
// Verify the blocks before the merging
177169
for i := 0; i < len(preBlocks); i++ {
178-
_, results := runEngine.VerifyHeaders(chain, []*types.Header{preHeaders[i]}, []bool{true})
170+
_, results := engine.VerifyHeaders(chain, []*types.Header{preHeaders[i]}, []bool{true})
179171
// Wait for the verification result
180172
select {
181173
case result := <-results:
@@ -200,7 +192,7 @@ func testHeaderVerificationForMerging(t *testing.T, isClique bool) {
200192

201193
// Verify the blocks after the merging
202194
for i := 0; i < len(postBlocks); i++ {
203-
_, results := runEngine.VerifyHeaders(chain, []*types.Header{postHeaders[i]}, []bool{true})
195+
_, results := engine.VerifyHeaders(chain, []*types.Header{postHeaders[i]}, []bool{true})
204196
// Wait for the verification result
205197
select {
206198
case result := <-results:
@@ -232,7 +224,7 @@ func testHeaderVerificationForMerging(t *testing.T, isClique bool) {
232224
headers = append(headers, block.Header())
233225
seals = append(seals, true)
234226
}
235-
_, results := runEngine.VerifyHeaders(chain, headers, seals)
227+
_, results := engine.VerifyHeaders(chain, headers, seals)
236228
for i := 0; i < len(headers); i++ {
237229
select {
238230
case result := <-results:
@@ -259,10 +251,8 @@ func TestHeaderConcurrentVerification32(t *testing.T) { testHeaderConcurrentVeri
259251
func testHeaderConcurrentVerification(t *testing.T, threads int) {
260252
// Create a simple chain to verify
261253
var (
262-
testdb = rawdb.NewMemoryDatabase()
263-
gspec = &Genesis{Config: params.TestChainConfig}
264-
genesis = gspec.MustCommit(testdb)
265-
blocks, _ = GenerateChain(params.TestChainConfig, genesis, ethash.NewFaker(), testdb, 8, nil)
254+
gspec = &Genesis{Config: params.TestChainConfig}
255+
_, blocks, _ = GenerateChainWithGenesis(gspec, ethash.NewFaker(), 8, nil)
266256
)
267257
headers := make([]*types.Header, len(blocks))
268258
seals := make([]bool, len(blocks))
@@ -281,11 +271,11 @@ func testHeaderConcurrentVerification(t *testing.T, threads int) {
281271
var results <-chan error
282272

283273
if valid {
284-
chain, _ := NewBlockChain(testdb, nil, gspec, nil, ethash.NewFaker(), vm.Config{}, nil, nil)
274+
chain, _ := NewBlockChain(rawdb.NewMemoryDatabase(), nil, gspec, nil, ethash.NewFaker(), vm.Config{}, nil, nil)
285275
_, results = chain.engine.VerifyHeaders(chain, headers, seals)
286276
chain.Stop()
287277
} else {
288-
chain, _ := NewBlockChain(testdb, nil, gspec, nil, ethash.NewFakeFailer(uint64(len(headers)-1)), vm.Config{}, nil, nil)
278+
chain, _ := NewBlockChain(rawdb.NewMemoryDatabase(), nil, gspec, nil, ethash.NewFakeFailer(uint64(len(headers)-1)), vm.Config{}, nil, nil)
289279
_, results = chain.engine.VerifyHeaders(chain, headers, seals)
290280
chain.Stop()
291281
}
@@ -331,10 +321,8 @@ func TestHeaderConcurrentAbortion32(t *testing.T) { testHeaderConcurrentAbortion
331321
func testHeaderConcurrentAbortion(t *testing.T, threads int) {
332322
// Create a simple chain to verify
333323
var (
334-
testdb = rawdb.NewMemoryDatabase()
335-
gspec = &Genesis{Config: params.TestChainConfig}
336-
genesis = gspec.MustCommit(testdb)
337-
blocks, _ = GenerateChain(params.TestChainConfig, genesis, ethash.NewFaker(), testdb, 1024, nil)
324+
gspec = &Genesis{Config: params.TestChainConfig}
325+
_, blocks, _ = GenerateChainWithGenesis(gspec, ethash.NewFaker(), 1024, nil)
338326
)
339327
headers := make([]*types.Header, len(blocks))
340328
seals := make([]bool, len(blocks))
@@ -348,7 +336,7 @@ func testHeaderConcurrentAbortion(t *testing.T, threads int) {
348336
defer runtime.GOMAXPROCS(old)
349337

350338
// Start the verifications and immediately abort
351-
chain, _ := NewBlockChain(testdb, nil, gspec, nil, ethash.NewFakeDelayer(time.Millisecond), vm.Config{}, nil, nil)
339+
chain, _ := NewBlockChain(rawdb.NewMemoryDatabase(), nil, gspec, nil, ethash.NewFakeDelayer(time.Millisecond), vm.Config{}, nil, nil)
352340
defer chain.Stop()
353341

354342
abort, results := chain.engine.VerifyHeaders(chain, headers, seals)

core/blockchain_repair_test.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1768,9 +1768,8 @@ func testRepair(t *testing.T, tt *rewindTest, snapshots bool) {
17681768
BaseFee: big.NewInt(params.InitialBaseFee),
17691769
Config: params.AllEthashProtocolChanges,
17701770
}
1771-
genesis = gspec.MustCommit(db)
1772-
engine = ethash.NewFullFaker()
1773-
config = &CacheConfig{
1771+
engine = ethash.NewFullFaker()
1772+
config = &CacheConfig{
17741773
TrieCleanLimit: 256,
17751774
TrieDirtyLimit: 256,
17761775
TrieTimeLimit: 5 * time.Minute,
@@ -1789,14 +1788,14 @@ func testRepair(t *testing.T, tt *rewindTest, snapshots bool) {
17891788
// If sidechain blocks are needed, make a light chain and import it
17901789
var sideblocks types.Blocks
17911790
if tt.sidechainBlocks > 0 {
1792-
sideblocks, _ = GenerateChain(params.TestChainConfig, genesis, engine, rawdb.NewMemoryDatabase(), tt.sidechainBlocks, func(i int, b *BlockGen) {
1791+
sideblocks, _ = GenerateChain(gspec.Config, gspec.ToBlock(), engine, rawdb.NewMemoryDatabase(), tt.sidechainBlocks, func(i int, b *BlockGen) {
17931792
b.SetCoinbase(common.Address{0x01})
17941793
})
17951794
if _, err := chain.InsertChain(sideblocks); err != nil {
17961795
t.Fatalf("Failed to import side chain: %v", err)
17971796
}
17981797
}
1799-
canonblocks, _ := GenerateChain(params.TestChainConfig, genesis, engine, rawdb.NewMemoryDatabase(), tt.canonicalBlocks, func(i int, b *BlockGen) {
1798+
canonblocks, _ := GenerateChain(gspec.Config, gspec.ToBlock(), engine, rawdb.NewMemoryDatabase(), tt.canonicalBlocks, func(i int, b *BlockGen) {
18001799
b.SetCoinbase(common.Address{0x02})
18011800
b.SetDifficulty(big.NewInt(1000000))
18021801
})
@@ -1896,9 +1895,8 @@ func TestIssue23496(t *testing.T) {
18961895
Config: params.TestChainConfig,
18971896
BaseFee: big.NewInt(params.InitialBaseFee),
18981897
}
1899-
genesis = gspec.MustCommit(db)
1900-
engine = ethash.NewFullFaker()
1901-
config = &CacheConfig{
1898+
engine = ethash.NewFullFaker()
1899+
config = &CacheConfig{
19021900
TrieCleanLimit: 256,
19031901
TrieDirtyLimit: 256,
19041902
TrieTimeLimit: 5 * time.Minute,
@@ -1910,7 +1908,7 @@ func TestIssue23496(t *testing.T) {
19101908
if err != nil {
19111909
t.Fatalf("Failed to create chain: %v", err)
19121910
}
1913-
blocks, _ := GenerateChain(params.TestChainConfig, genesis, engine, rawdb.NewMemoryDatabase(), 4, func(i int, b *BlockGen) {
1911+
_, blocks, _ := GenerateChainWithGenesis(gspec, engine, 4, func(i int, b *BlockGen) {
19141912
b.SetCoinbase(common.Address{0x02})
19151913
b.SetDifficulty(big.NewInt(1000000))
19161914
})

core/blockchain_sethead_test.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1968,9 +1968,8 @@ func testSetHead(t *testing.T, tt *rewindTest, snapshots bool) {
19681968
BaseFee: big.NewInt(params.InitialBaseFee),
19691969
Config: params.AllEthashProtocolChanges,
19701970
}
1971-
genesis = gspec.MustCommit(db)
1972-
engine = ethash.NewFullFaker()
1973-
config = &CacheConfig{
1971+
engine = ethash.NewFullFaker()
1972+
config = &CacheConfig{
19741973
TrieCleanLimit: 256,
19751974
TrieDirtyLimit: 256,
19761975
TrieTimeLimit: 5 * time.Minute,
@@ -1988,14 +1987,14 @@ func testSetHead(t *testing.T, tt *rewindTest, snapshots bool) {
19881987
// If sidechain blocks are needed, make a light chain and import it
19891988
var sideblocks types.Blocks
19901989
if tt.sidechainBlocks > 0 {
1991-
sideblocks, _ = GenerateChain(params.TestChainConfig, genesis, engine, rawdb.NewMemoryDatabase(), tt.sidechainBlocks, func(i int, b *BlockGen) {
1990+
sideblocks, _ = GenerateChain(gspec.Config, gspec.ToBlock(), engine, rawdb.NewMemoryDatabase(), tt.sidechainBlocks, func(i int, b *BlockGen) {
19921991
b.SetCoinbase(common.Address{0x01})
19931992
})
19941993
if _, err := chain.InsertChain(sideblocks); err != nil {
19951994
t.Fatalf("Failed to import side chain: %v", err)
19961995
}
19971996
}
1998-
canonblocks, _ := GenerateChain(params.TestChainConfig, genesis, engine, rawdb.NewMemoryDatabase(), tt.canonicalBlocks, func(i int, b *BlockGen) {
1997+
canonblocks, _ := GenerateChain(gspec.Config, gspec.ToBlock(), engine, rawdb.NewMemoryDatabase(), tt.canonicalBlocks, func(i int, b *BlockGen) {
19991998
b.SetCoinbase(common.Address{0x02})
20001999
b.SetDifficulty(big.NewInt(1000000))
20012000
})

core/blockchain_snapshot_test.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,7 @@ func (basic *snapshotTestBasic) prepare(t *testing.T) (*BlockChain, []*types.Blo
7171
BaseFee: big.NewInt(params.InitialBaseFee),
7272
Config: params.AllEthashProtocolChanges,
7373
}
74-
genesis = gspec.MustCommit(db)
75-
engine = ethash.NewFullFaker()
76-
gendb = rawdb.NewMemoryDatabase()
74+
engine = ethash.NewFullFaker()
7775

7876
// Snapshot is enabled, the first snapshot is created from the Genesis.
7977
// The snapshot memory allowance is 256MB, it means no snapshot flush
@@ -84,7 +82,7 @@ func (basic *snapshotTestBasic) prepare(t *testing.T) (*BlockChain, []*types.Blo
8482
if err != nil {
8583
t.Fatalf("Failed to create chain: %v", err)
8684
}
87-
blocks, _ := GenerateChain(params.TestChainConfig, genesis, engine, gendb, basic.chainBlocks, func(i int, b *BlockGen) {})
85+
gendb, blocks, _ := GenerateChainWithGenesis(gspec, engine, basic.chainBlocks, func(i int, b *BlockGen) {})
8886

8987
// Insert the blocks with configured settings.
9088
var breakpoints []uint64
@@ -395,7 +393,6 @@ func (snaptest *wipeCrashSnapshotTest) test(t *testing.T) {
395393
t.Fatalf("Failed to recreate chain: %v", err)
396394
}
397395
// Simulate the blockchain crash.
398-
399396
newchain, err = NewBlockChain(snaptest.db, nil, snaptest.gspec, nil, snaptest.engine, vm.Config{}, nil, nil)
400397
if err != nil {
401398
t.Fatalf("Failed to recreate chain: %v", err)

0 commit comments

Comments
 (0)