aboutsummaryrefslogtreecommitdiffstats
path: root/core/blockchain_test.go
diff options
context:
space:
mode:
authorBJ4 <bojie@dexon.org>2018-11-09 12:08:17 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-06-12 17:27:18 +0800
commit3911752697b6718fd8014146776378c465a8e88e (patch)
treeaddb109dae061bf4fdc8078522b1be2374c57f2b /core/blockchain_test.go
parentbfe8dc4f017f1fa3e6e2b0c370f7880ef847a7d4 (diff)
downloadgo-tangerine-3911752697b6718fd8014146776378c465a8e88e.tar
go-tangerine-3911752697b6718fd8014146776378c465a8e88e.tar.gz
go-tangerine-3911752697b6718fd8014146776378c465a8e88e.tar.bz2
go-tangerine-3911752697b6718fd8014146776378c465a8e88e.tar.lz
go-tangerine-3911752697b6718fd8014146776378c465a8e88e.tar.xz
go-tangerine-3911752697b6718fd8014146776378c465a8e88e.tar.zst
go-tangerine-3911752697b6718fd8014146776378c465a8e88e.zip
app: fix core test
Diffstat (limited to 'core/blockchain_test.go')
-rw-r--r--core/blockchain_test.go38
1 files changed, 28 insertions, 10 deletions
diff --git a/core/blockchain_test.go b/core/blockchain_test.go
index 72b21034b..bbaaf5e6d 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
@@ -1275,9 +1278,13 @@ func TestEIP155Transition(t *testing.T) {
Config: &params.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()
@@ -1383,8 +1390,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()
@@ -1442,7 +1451,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
@@ -1458,7 +1470,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 {
@@ -1487,7 +1499,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
@@ -1502,7 +1517,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 {
@@ -1533,7 +1548,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}) })
@@ -1541,7 +1559,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 {