|
|
|
@ -53,7 +53,7 @@ func thePow() pow.PoW { |
|
|
|
|
func theBlockChain(db ethdb.Database, t *testing.T) *BlockChain { |
|
|
|
|
var eventMux event.TypeMux |
|
|
|
|
WriteTestNetGenesisBlock(db) |
|
|
|
|
blockchain, err := NewBlockChain(db, testChainConfig(), thePow(), &eventMux) |
|
|
|
|
blockchain, err := NewBlockChain(db, testChainConfig(), thePow(), &eventMux, vm.Config{}) |
|
|
|
|
if err != nil { |
|
|
|
|
t.Error("failed creating blockchain:", err) |
|
|
|
|
t.FailNow() |
|
|
|
@ -614,7 +614,7 @@ func testReorgBadHashes(t *testing.T, full bool) { |
|
|
|
|
defer func() { delete(BadHashes, headers[3].Hash()) }() |
|
|
|
|
} |
|
|
|
|
// Create a new chain manager and check it rolled back the state
|
|
|
|
|
ncm, err := NewBlockChain(db, testChainConfig(), FakePow{}, new(event.TypeMux)) |
|
|
|
|
ncm, err := NewBlockChain(db, testChainConfig(), FakePow{}, new(event.TypeMux), vm.Config{}) |
|
|
|
|
if err != nil { |
|
|
|
|
t.Fatalf("failed to create new chain manager: %v", err) |
|
|
|
|
} |
|
|
|
@ -735,7 +735,7 @@ func TestFastVsFullChains(t *testing.T) { |
|
|
|
|
archiveDb, _ := ethdb.NewMemDatabase() |
|
|
|
|
WriteGenesisBlockForTesting(archiveDb, GenesisAccount{address, funds}) |
|
|
|
|
|
|
|
|
|
archive, _ := NewBlockChain(archiveDb, testChainConfig(), FakePow{}, new(event.TypeMux)) |
|
|
|
|
archive, _ := NewBlockChain(archiveDb, testChainConfig(), FakePow{}, new(event.TypeMux), vm.Config{}) |
|
|
|
|
|
|
|
|
|
if n, err := archive.InsertChain(blocks); err != nil { |
|
|
|
|
t.Fatalf("failed to process block %d: %v", n, err) |
|
|
|
@ -743,7 +743,7 @@ func TestFastVsFullChains(t *testing.T) { |
|
|
|
|
// Fast import the chain as a non-archive node to test
|
|
|
|
|
fastDb, _ := ethdb.NewMemDatabase() |
|
|
|
|
WriteGenesisBlockForTesting(fastDb, GenesisAccount{address, funds}) |
|
|
|
|
fast, _ := NewBlockChain(fastDb, testChainConfig(), FakePow{}, new(event.TypeMux)) |
|
|
|
|
fast, _ := NewBlockChain(fastDb, testChainConfig(), FakePow{}, new(event.TypeMux), vm.Config{}) |
|
|
|
|
|
|
|
|
|
headers := make([]*types.Header, len(blocks)) |
|
|
|
|
for i, block := range blocks { |
|
|
|
@ -819,7 +819,7 @@ func TestLightVsFastVsFullChainHeads(t *testing.T) { |
|
|
|
|
archiveDb, _ := ethdb.NewMemDatabase() |
|
|
|
|
WriteGenesisBlockForTesting(archiveDb, GenesisAccount{address, funds}) |
|
|
|
|
|
|
|
|
|
archive, _ := NewBlockChain(archiveDb, testChainConfig(), FakePow{}, new(event.TypeMux)) |
|
|
|
|
archive, _ := NewBlockChain(archiveDb, testChainConfig(), FakePow{}, new(event.TypeMux), vm.Config{}) |
|
|
|
|
|
|
|
|
|
if n, err := archive.InsertChain(blocks); err != nil { |
|
|
|
|
t.Fatalf("failed to process block %d: %v", n, err) |
|
|
|
@ -831,7 +831,7 @@ func TestLightVsFastVsFullChainHeads(t *testing.T) { |
|
|
|
|
// Import the chain as a non-archive node and ensure all pointers are updated
|
|
|
|
|
fastDb, _ := ethdb.NewMemDatabase() |
|
|
|
|
WriteGenesisBlockForTesting(fastDb, GenesisAccount{address, funds}) |
|
|
|
|
fast, _ := NewBlockChain(fastDb, testChainConfig(), FakePow{}, new(event.TypeMux)) |
|
|
|
|
fast, _ := NewBlockChain(fastDb, testChainConfig(), FakePow{}, new(event.TypeMux), vm.Config{}) |
|
|
|
|
|
|
|
|
|
headers := make([]*types.Header, len(blocks)) |
|
|
|
|
for i, block := range blocks { |
|
|
|
@ -850,7 +850,7 @@ func TestLightVsFastVsFullChainHeads(t *testing.T) { |
|
|
|
|
// Import the chain as a light node and ensure all pointers are updated
|
|
|
|
|
lightDb, _ := ethdb.NewMemDatabase() |
|
|
|
|
WriteGenesisBlockForTesting(lightDb, GenesisAccount{address, funds}) |
|
|
|
|
light, _ := NewBlockChain(lightDb, testChainConfig(), FakePow{}, new(event.TypeMux)) |
|
|
|
|
light, _ := NewBlockChain(lightDb, testChainConfig(), FakePow{}, new(event.TypeMux), vm.Config{}) |
|
|
|
|
|
|
|
|
|
if n, err := light.InsertHeaderChain(headers, 1); err != nil { |
|
|
|
|
t.Fatalf("failed to insert header %d: %v", n, err) |
|
|
|
@ -916,7 +916,7 @@ func TestChainTxReorgs(t *testing.T) { |
|
|
|
|
}) |
|
|
|
|
// Import the chain. This runs all block validation rules.
|
|
|
|
|
evmux := &event.TypeMux{} |
|
|
|
|
blockchain, _ := NewBlockChain(db, testChainConfig(), FakePow{}, evmux) |
|
|
|
|
blockchain, _ := NewBlockChain(db, testChainConfig(), FakePow{}, evmux, vm.Config{}) |
|
|
|
|
if i, err := blockchain.InsertChain(chain); err != nil { |
|
|
|
|
t.Fatalf("failed to insert original chain[%d]: %v", i, err) |
|
|
|
|
} |
|
|
|
@ -990,7 +990,7 @@ func TestLogReorgs(t *testing.T) { |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
evmux := &event.TypeMux{} |
|
|
|
|
blockchain, _ := NewBlockChain(db, testChainConfig(), FakePow{}, evmux) |
|
|
|
|
blockchain, _ := NewBlockChain(db, testChainConfig(), FakePow{}, evmux, vm.Config{}) |
|
|
|
|
|
|
|
|
|
subs := evmux.Subscribe(RemovedLogsEvent{}) |
|
|
|
|
chain, _ := GenerateChain(params.TestChainConfig, genesis, db, 2, func(i int, gen *BlockGen) { |
|
|
|
@ -1027,7 +1027,7 @@ func TestReorgSideEvent(t *testing.T) { |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
evmux := &event.TypeMux{} |
|
|
|
|
blockchain, _ := NewBlockChain(db, testChainConfig(), FakePow{}, evmux) |
|
|
|
|
blockchain, _ := NewBlockChain(db, testChainConfig(), FakePow{}, evmux, vm.Config{}) |
|
|
|
|
|
|
|
|
|
chain, _ := GenerateChain(params.TestChainConfig, genesis, db, 3, func(i int, gen *BlockGen) {}) |
|
|
|
|
if _, err := blockchain.InsertChain(chain); err != nil { |
|
|
|
@ -1103,7 +1103,7 @@ func TestCanonicalBlockRetrieval(t *testing.T) { |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
evmux := &event.TypeMux{} |
|
|
|
|
blockchain, _ := NewBlockChain(db, testChainConfig(), FakePow{}, evmux) |
|
|
|
|
blockchain, _ := NewBlockChain(db, testChainConfig(), FakePow{}, evmux, vm.Config{}) |
|
|
|
|
|
|
|
|
|
chain, _ := GenerateChain(params.TestChainConfig, genesis, db, 10, func(i int, gen *BlockGen) {}) |
|
|
|
|
|
|
|
|
@ -1146,7 +1146,7 @@ func TestEIP155Transition(t *testing.T) { |
|
|
|
|
mux event.TypeMux |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
blockchain, _ := NewBlockChain(db, config, FakePow{}, &mux) |
|
|
|
|
blockchain, _ := NewBlockChain(db, config, FakePow{}, &mux, vm.Config{}) |
|
|
|
|
blocks, _ := GenerateChain(config, genesis, db, 4, func(i int, block *BlockGen) { |
|
|
|
|
var ( |
|
|
|
|
tx *types.Transaction |
|
|
|
@ -1250,7 +1250,7 @@ func TestEIP161AccountRemoval(t *testing.T) { |
|
|
|
|
} |
|
|
|
|
mux event.TypeMux |
|
|
|
|
|
|
|
|
|
blockchain, _ = NewBlockChain(db, config, FakePow{}, &mux) |
|
|
|
|
blockchain, _ = NewBlockChain(db, config, FakePow{}, &mux, vm.Config{}) |
|
|
|
|
) |
|
|
|
|
blocks, _ := GenerateChain(config, genesis, db, 3, func(i int, block *BlockGen) { |
|
|
|
|
var ( |
|
|
|
|