diff options
author | BJ4 <bojie@dexon.org> | 2018-11-09 12:08:17 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2018-12-19 20:54:27 +0800 |
commit | 2bc760c1e23e18bfe3807e3e4d0b9cb6c028cf89 (patch) | |
tree | f9711f1d34062c5a047c1bec291cf02539521b93 /core/blockchain_test.go | |
parent | 9705ed77f413fcd64a8024095c91b28fb5f3d20e (diff) | |
download | dexon-2bc760c1e23e18bfe3807e3e4d0b9cb6c028cf89.tar dexon-2bc760c1e23e18bfe3807e3e4d0b9cb6c028cf89.tar.gz dexon-2bc760c1e23e18bfe3807e3e4d0b9cb6c028cf89.tar.bz2 dexon-2bc760c1e23e18bfe3807e3e4d0b9cb6c028cf89.tar.lz dexon-2bc760c1e23e18bfe3807e3e4d0b9cb6c028cf89.tar.xz dexon-2bc760c1e23e18bfe3807e3e4d0b9cb6c028cf89.tar.zst dexon-2bc760c1e23e18bfe3807e3e4d0b9cb6c028cf89.zip |
app: fix core test
Diffstat (limited to 'core/blockchain_test.go')
-rw-r--r-- | core/blockchain_test.go | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/core/blockchain_test.go b/core/blockchain_test.go index 51a85da14..b97f4be6e 100644 --- a/core/blockchain_test.go +++ b/core/blockchain_test.go @@ -47,10 +47,13 @@ var ( // header only chain. func newCanonical(engine consensus.Engine, n int, full bool) (ethdb.Database, *BlockChain, error) { var ( - db = ethdb.NewMemDatabase() - genesis = new(Genesis).MustCommit(db) + db = ethdb.NewMemDatabase() + g = new(Genesis) ) + g.Config = params.TestnetChainConfig + genesis := g.MustCommit(db) + // Initialize a fresh chain with only a genesis block blockchain, _ := NewBlockChain(db, nil, params.AllEthashProtocolChanges, engine, vm.Config{}, nil) // Create and inject the requested chain @@ -1069,9 +1072,13 @@ func TestEIP155Transition(t *testing.T) { Config: ¶ms.ChainConfig{ChainID: big.NewInt(1), EIP155Block: big.NewInt(2), HomesteadBlock: new(big.Int)}, Alloc: GenesisAlloc{address: {Balance: funds}, deleteAddr: {Balance: new(big.Int)}}, } - genesis = gspec.MustCommit(db) ) + dexConf := new(params.DexconConfig) + dexConf.BlockReward = new(big.Int) + gspec.Config.Dexcon = dexConf + genesis := gspec.MustCommit(db) + blockchain, _ := NewBlockChain(db, nil, gspec.Config, ethash.NewFaker(), vm.Config{}, nil) defer blockchain.Stop() @@ -1177,8 +1184,10 @@ func TestEIP161AccountRemoval(t *testing.T) { }, Alloc: GenesisAlloc{address: {Balance: funds}}, } - genesis = gspec.MustCommit(db) ) + + gspec.Config.Dexcon = params.TestChainConfig.Dexcon + genesis := gspec.MustCommit(db) blockchain, _ := NewBlockChain(db, nil, gspec.Config, ethash.NewFaker(), vm.Config{}, nil) defer blockchain.Stop() @@ -1236,7 +1245,10 @@ func TestBlockchainHeaderchainReorgConsistency(t *testing.T) { engine := ethash.NewFaker() db := ethdb.NewMemDatabase() - genesis := new(Genesis).MustCommit(db) + gspec := &Genesis{ + Config: params.TestnetChainConfig, + } + genesis := gspec.MustCommit(db) blocks, _ := GenerateChain(params.TestChainConfig, genesis, engine, db, 64, func(i int, b *BlockGen) { b.SetCoinbase(common.Address{1}) }) // Generate a bunch of fork blocks, each side forking from the canonical chain @@ -1252,7 +1264,7 @@ func TestBlockchainHeaderchainReorgConsistency(t *testing.T) { // Import the canonical and fork chain side by side, verifying the current block // and current header consistency diskdb := ethdb.NewMemDatabase() - new(Genesis).MustCommit(diskdb) + gspec.MustCommit(diskdb) chain, err := NewBlockChain(diskdb, nil, params.TestChainConfig, engine, vm.Config{}, nil) if err != nil { @@ -1281,7 +1293,10 @@ func TestTrieForkGC(t *testing.T) { engine := ethash.NewFaker() db := ethdb.NewMemDatabase() - genesis := new(Genesis).MustCommit(db) + gspec := &Genesis{ + Config: params.TestnetChainConfig, + } + genesis := gspec.MustCommit(db) blocks, _ := GenerateChain(params.TestChainConfig, genesis, engine, db, 2*triesInMemory, func(i int, b *BlockGen) { b.SetCoinbase(common.Address{1}) }) // Generate a bunch of fork blocks, each side forking from the canonical chain @@ -1296,7 +1311,7 @@ func TestTrieForkGC(t *testing.T) { } // Import the canonical and fork chain side by side, forcing the trie cache to cache both diskdb := ethdb.NewMemDatabase() - new(Genesis).MustCommit(diskdb) + gspec.MustCommit(diskdb) chain, err := NewBlockChain(diskdb, nil, params.TestChainConfig, engine, vm.Config{}, nil) if err != nil { @@ -1327,7 +1342,10 @@ func TestLargeReorgTrieGC(t *testing.T) { engine := ethash.NewFaker() db := ethdb.NewMemDatabase() - genesis := new(Genesis).MustCommit(db) + gspec := &Genesis{ + Config: params.TestnetChainConfig, + } + genesis := gspec.MustCommit(db) shared, _ := GenerateChain(params.TestChainConfig, genesis, engine, db, 64, func(i int, b *BlockGen) { b.SetCoinbase(common.Address{1}) }) original, _ := GenerateChain(params.TestChainConfig, shared[len(shared)-1], engine, db, 2*triesInMemory, func(i int, b *BlockGen) { b.SetCoinbase(common.Address{2}) }) @@ -1335,7 +1353,7 @@ func TestLargeReorgTrieGC(t *testing.T) { // Import the shared chain and the original canonical one diskdb := ethdb.NewMemDatabase() - new(Genesis).MustCommit(diskdb) + gspec.MustCommit(diskdb) chain, err := NewBlockChain(diskdb, nil, params.TestChainConfig, engine, vm.Config{}, nil) if err != nil { |