|
|
|
@ -52,7 +52,7 @@ func newCanonical(engine consensus.Engine, n int, full bool) (ethdb.Database, *B |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
// Initialize a fresh chain with only a genesis block
|
|
|
|
|
blockchain, _ := NewBlockChain(db, nil, params.AllEthashProtocolChanges, engine, vm.Config{}) |
|
|
|
|
blockchain, _ := NewBlockChain(db, nil, params.AllEthashProtocolChanges, engine, vm.Config{}, nil) |
|
|
|
|
// Create and inject the requested chain
|
|
|
|
|
if n == 0 { |
|
|
|
|
return db, blockchain, nil |
|
|
|
@ -523,7 +523,7 @@ func testReorgBadHashes(t *testing.T, full bool) { |
|
|
|
|
blockchain.Stop() |
|
|
|
|
|
|
|
|
|
// Create a new BlockChain and check that it rolled back the state.
|
|
|
|
|
ncm, err := NewBlockChain(blockchain.db, nil, blockchain.chainConfig, ethash.NewFaker(), vm.Config{}) |
|
|
|
|
ncm, err := NewBlockChain(blockchain.db, nil, blockchain.chainConfig, ethash.NewFaker(), vm.Config{}, nil) |
|
|
|
|
if err != nil { |
|
|
|
|
t.Fatalf("failed to create new chain manager: %v", err) |
|
|
|
|
} |
|
|
|
@ -635,7 +635,7 @@ func TestFastVsFullChains(t *testing.T) { |
|
|
|
|
// Import the chain as an archive node for the comparison baseline
|
|
|
|
|
archiveDb := ethdb.NewMemDatabase() |
|
|
|
|
gspec.MustCommit(archiveDb) |
|
|
|
|
archive, _ := NewBlockChain(archiveDb, nil, gspec.Config, ethash.NewFaker(), vm.Config{}) |
|
|
|
|
archive, _ := NewBlockChain(archiveDb, nil, gspec.Config, ethash.NewFaker(), vm.Config{}, nil) |
|
|
|
|
defer archive.Stop() |
|
|
|
|
|
|
|
|
|
if n, err := archive.InsertChain(blocks); err != nil { |
|
|
|
@ -644,7 +644,7 @@ func TestFastVsFullChains(t *testing.T) { |
|
|
|
|
// Fast import the chain as a non-archive node to test
|
|
|
|
|
fastDb := ethdb.NewMemDatabase() |
|
|
|
|
gspec.MustCommit(fastDb) |
|
|
|
|
fast, _ := NewBlockChain(fastDb, nil, gspec.Config, ethash.NewFaker(), vm.Config{}) |
|
|
|
|
fast, _ := NewBlockChain(fastDb, nil, gspec.Config, ethash.NewFaker(), vm.Config{}, nil) |
|
|
|
|
defer fast.Stop() |
|
|
|
|
|
|
|
|
|
headers := make([]*types.Header, len(blocks)) |
|
|
|
@ -722,7 +722,7 @@ func TestLightVsFastVsFullChainHeads(t *testing.T) { |
|
|
|
|
archiveDb := ethdb.NewMemDatabase() |
|
|
|
|
gspec.MustCommit(archiveDb) |
|
|
|
|
|
|
|
|
|
archive, _ := NewBlockChain(archiveDb, nil, gspec.Config, ethash.NewFaker(), vm.Config{}) |
|
|
|
|
archive, _ := NewBlockChain(archiveDb, nil, gspec.Config, ethash.NewFaker(), vm.Config{}, nil) |
|
|
|
|
if n, err := archive.InsertChain(blocks); err != nil { |
|
|
|
|
t.Fatalf("failed to process block %d: %v", n, err) |
|
|
|
|
} |
|
|
|
@ -735,7 +735,7 @@ func TestLightVsFastVsFullChainHeads(t *testing.T) { |
|
|
|
|
// Import the chain as a non-archive node and ensure all pointers are updated
|
|
|
|
|
fastDb := ethdb.NewMemDatabase() |
|
|
|
|
gspec.MustCommit(fastDb) |
|
|
|
|
fast, _ := NewBlockChain(fastDb, nil, gspec.Config, ethash.NewFaker(), vm.Config{}) |
|
|
|
|
fast, _ := NewBlockChain(fastDb, nil, gspec.Config, ethash.NewFaker(), vm.Config{}, nil) |
|
|
|
|
defer fast.Stop() |
|
|
|
|
|
|
|
|
|
headers := make([]*types.Header, len(blocks)) |
|
|
|
@ -756,7 +756,7 @@ func TestLightVsFastVsFullChainHeads(t *testing.T) { |
|
|
|
|
lightDb := ethdb.NewMemDatabase() |
|
|
|
|
gspec.MustCommit(lightDb) |
|
|
|
|
|
|
|
|
|
light, _ := NewBlockChain(lightDb, nil, gspec.Config, ethash.NewFaker(), vm.Config{}) |
|
|
|
|
light, _ := NewBlockChain(lightDb, nil, gspec.Config, ethash.NewFaker(), vm.Config{}, nil) |
|
|
|
|
if n, err := light.InsertHeaderChain(headers, 1); err != nil { |
|
|
|
|
t.Fatalf("failed to insert header %d: %v", n, err) |
|
|
|
|
} |
|
|
|
@ -825,7 +825,7 @@ func TestChainTxReorgs(t *testing.T) { |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
// Import the chain. This runs all block validation rules.
|
|
|
|
|
blockchain, _ := NewBlockChain(db, nil, gspec.Config, ethash.NewFaker(), vm.Config{}) |
|
|
|
|
blockchain, _ := NewBlockChain(db, nil, gspec.Config, ethash.NewFaker(), vm.Config{}, nil) |
|
|
|
|
if i, err := blockchain.InsertChain(chain); err != nil { |
|
|
|
|
t.Fatalf("failed to insert original chain[%d]: %v", i, err) |
|
|
|
|
} |
|
|
|
@ -896,7 +896,7 @@ func TestLogReorgs(t *testing.T) { |
|
|
|
|
signer = types.NewEIP155Signer(gspec.Config.ChainID) |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
blockchain, _ := NewBlockChain(db, nil, gspec.Config, ethash.NewFaker(), vm.Config{}) |
|
|
|
|
blockchain, _ := NewBlockChain(db, nil, gspec.Config, ethash.NewFaker(), vm.Config{}, nil) |
|
|
|
|
defer blockchain.Stop() |
|
|
|
|
|
|
|
|
|
rmLogsCh := make(chan RemovedLogsEvent) |
|
|
|
@ -943,7 +943,7 @@ func TestReorgSideEvent(t *testing.T) { |
|
|
|
|
signer = types.NewEIP155Signer(gspec.Config.ChainID) |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
blockchain, _ := NewBlockChain(db, nil, gspec.Config, ethash.NewFaker(), vm.Config{}) |
|
|
|
|
blockchain, _ := NewBlockChain(db, nil, gspec.Config, ethash.NewFaker(), vm.Config{}, nil) |
|
|
|
|
defer blockchain.Stop() |
|
|
|
|
|
|
|
|
|
chain, _ := GenerateChain(gspec.Config, genesis, ethash.NewFaker(), db, 3, func(i int, gen *BlockGen) {}) |
|
|
|
@ -1072,7 +1072,7 @@ func TestEIP155Transition(t *testing.T) { |
|
|
|
|
genesis = gspec.MustCommit(db) |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
blockchain, _ := NewBlockChain(db, nil, gspec.Config, ethash.NewFaker(), vm.Config{}) |
|
|
|
|
blockchain, _ := NewBlockChain(db, nil, gspec.Config, ethash.NewFaker(), vm.Config{}, nil) |
|
|
|
|
defer blockchain.Stop() |
|
|
|
|
|
|
|
|
|
blocks, _ := GenerateChain(gspec.Config, genesis, ethash.NewFaker(), db, 4, func(i int, block *BlockGen) { |
|
|
|
@ -1179,7 +1179,7 @@ func TestEIP161AccountRemoval(t *testing.T) { |
|
|
|
|
} |
|
|
|
|
genesis = gspec.MustCommit(db) |
|
|
|
|
) |
|
|
|
|
blockchain, _ := NewBlockChain(db, nil, gspec.Config, ethash.NewFaker(), vm.Config{}) |
|
|
|
|
blockchain, _ := NewBlockChain(db, nil, gspec.Config, ethash.NewFaker(), vm.Config{}, nil) |
|
|
|
|
defer blockchain.Stop() |
|
|
|
|
|
|
|
|
|
blocks, _ := GenerateChain(gspec.Config, genesis, ethash.NewFaker(), db, 3, func(i int, block *BlockGen) { |
|
|
|
@ -1254,7 +1254,7 @@ func TestBlockchainHeaderchainReorgConsistency(t *testing.T) { |
|
|
|
|
diskdb := ethdb.NewMemDatabase() |
|
|
|
|
new(Genesis).MustCommit(diskdb) |
|
|
|
|
|
|
|
|
|
chain, err := NewBlockChain(diskdb, nil, params.TestChainConfig, engine, vm.Config{}) |
|
|
|
|
chain, err := NewBlockChain(diskdb, nil, params.TestChainConfig, engine, vm.Config{}, nil) |
|
|
|
|
if err != nil { |
|
|
|
|
t.Fatalf("failed to create tester chain: %v", err) |
|
|
|
|
} |
|
|
|
@ -1298,7 +1298,7 @@ func TestTrieForkGC(t *testing.T) { |
|
|
|
|
diskdb := ethdb.NewMemDatabase() |
|
|
|
|
new(Genesis).MustCommit(diskdb) |
|
|
|
|
|
|
|
|
|
chain, err := NewBlockChain(diskdb, nil, params.TestChainConfig, engine, vm.Config{}) |
|
|
|
|
chain, err := NewBlockChain(diskdb, nil, params.TestChainConfig, engine, vm.Config{}, nil) |
|
|
|
|
if err != nil { |
|
|
|
|
t.Fatalf("failed to create tester chain: %v", err) |
|
|
|
|
} |
|
|
|
@ -1337,7 +1337,7 @@ func TestLargeReorgTrieGC(t *testing.T) { |
|
|
|
|
diskdb := ethdb.NewMemDatabase() |
|
|
|
|
new(Genesis).MustCommit(diskdb) |
|
|
|
|
|
|
|
|
|
chain, err := NewBlockChain(diskdb, nil, params.TestChainConfig, engine, vm.Config{}) |
|
|
|
|
chain, err := NewBlockChain(diskdb, nil, params.TestChainConfig, engine, vm.Config{}, nil) |
|
|
|
|
if err != nil { |
|
|
|
|
t.Fatalf("failed to create tester chain: %v", err) |
|
|
|
|
} |
|
|
|
@ -1419,7 +1419,7 @@ func benchmarkLargeNumberOfValueToNonexisting(b *testing.B, numTxs, numBlocks in |
|
|
|
|
diskdb := ethdb.NewMemDatabase() |
|
|
|
|
gspec.MustCommit(diskdb) |
|
|
|
|
|
|
|
|
|
chain, err := NewBlockChain(diskdb, nil, params.TestChainConfig, engine, vm.Config{}) |
|
|
|
|
chain, err := NewBlockChain(diskdb, nil, params.TestChainConfig, engine, vm.Config{}, nil) |
|
|
|
|
if err != nil { |
|
|
|
|
b.Fatalf("failed to create tester chain: %v", err) |
|
|
|
|
} |
|
|
|
|