@@ -40,14 +40,22 @@ func TestDAOForkRangeExtradata(t *testing.T) {
4040 // Create the concurrent, conflicting two nodes
4141 proDb , _ := ethdb .NewMemDatabase ()
4242 gspec .MustCommit (proDb )
43- proConf := & params.ChainConfig {HomesteadBlock : big .NewInt (0 ), DAOForkBlock : forkBlock , DAOForkSupport : true }
44- proBc , _ := NewBlockChain (proDb , proConf , ethash .NewFaker (), vm.Config {})
43+
44+ proConf := * params .TestChainConfig
45+ proConf .DAOForkBlock = forkBlock
46+ proConf .DAOForkSupport = true
47+
48+ proBc , _ := NewBlockChain (proDb , & proConf , ethash .NewFaker (), vm.Config {})
4549 defer proBc .Stop ()
4650
4751 conDb , _ := ethdb .NewMemDatabase ()
4852 gspec .MustCommit (conDb )
49- conConf := & params.ChainConfig {HomesteadBlock : big .NewInt (0 ), DAOForkBlock : forkBlock , DAOForkSupport : false }
50- conBc , _ := NewBlockChain (conDb , conConf , ethash .NewFaker (), vm.Config {})
53+
54+ conConf := * params .TestChainConfig
55+ conConf .DAOForkBlock = forkBlock
56+ conConf .DAOForkSupport = false
57+
58+ conBc , _ := NewBlockChain (conDb , & conConf , ethash .NewFaker (), vm.Config {})
5159 defer conBc .Stop ()
5260
5361 if _ , err := proBc .InsertChain (prefix ); err != nil {
@@ -61,7 +69,7 @@ func TestDAOForkRangeExtradata(t *testing.T) {
6169 // Create a pro-fork block, and try to feed into the no-fork chain
6270 db , _ = ethdb .NewMemDatabase ()
6371 gspec .MustCommit (db )
64- bc , _ := NewBlockChain (db , conConf , ethash .NewFaker (), vm.Config {})
72+ bc , _ := NewBlockChain (db , & conConf , ethash .NewFaker (), vm.Config {})
6573 defer bc .Stop ()
6674
6775 blocks := conBc .GetBlocksFromHash (conBc .CurrentBlock ().Hash (), int (conBc .CurrentBlock ().NumberU64 ()))
@@ -71,19 +79,19 @@ func TestDAOForkRangeExtradata(t *testing.T) {
7179 if _ , err := bc .InsertChain (blocks ); err != nil {
7280 t .Fatalf ("failed to import contra-fork chain for expansion: %v" , err )
7381 }
74- blocks , _ = GenerateChain (proConf , conBc .CurrentBlock (), db , 1 , func (i int , gen * BlockGen ) {})
82+ blocks , _ = GenerateChain (& proConf , conBc .CurrentBlock (), db , 1 , func (i int , gen * BlockGen ) {})
7583 if _ , err := conBc .InsertChain (blocks ); err == nil {
7684 t .Fatalf ("contra-fork chain accepted pro-fork block: %v" , blocks [0 ])
7785 }
7886 // Create a proper no-fork block for the contra-forker
79- blocks , _ = GenerateChain (conConf , conBc .CurrentBlock (), db , 1 , func (i int , gen * BlockGen ) {})
87+ blocks , _ = GenerateChain (& conConf , conBc .CurrentBlock (), db , 1 , func (i int , gen * BlockGen ) {})
8088 if _ , err := conBc .InsertChain (blocks ); err != nil {
8189 t .Fatalf ("contra-fork chain didn't accepted no-fork block: %v" , err )
8290 }
8391 // Create a no-fork block, and try to feed into the pro-fork chain
8492 db , _ = ethdb .NewMemDatabase ()
8593 gspec .MustCommit (db )
86- bc , _ = NewBlockChain (db , proConf , ethash .NewFaker (), vm.Config {})
94+ bc , _ = NewBlockChain (db , & proConf , ethash .NewFaker (), vm.Config {})
8795 defer bc .Stop ()
8896
8997 blocks = proBc .GetBlocksFromHash (proBc .CurrentBlock ().Hash (), int (proBc .CurrentBlock ().NumberU64 ()))
@@ -93,20 +101,20 @@ func TestDAOForkRangeExtradata(t *testing.T) {
93101 if _ , err := bc .InsertChain (blocks ); err != nil {
94102 t .Fatalf ("failed to import pro-fork chain for expansion: %v" , err )
95103 }
96- blocks , _ = GenerateChain (conConf , proBc .CurrentBlock (), db , 1 , func (i int , gen * BlockGen ) {})
104+ blocks , _ = GenerateChain (& conConf , proBc .CurrentBlock (), db , 1 , func (i int , gen * BlockGen ) {})
97105 if _ , err := proBc .InsertChain (blocks ); err == nil {
98106 t .Fatalf ("pro-fork chain accepted contra-fork block: %v" , blocks [0 ])
99107 }
100108 // Create a proper pro-fork block for the pro-forker
101- blocks , _ = GenerateChain (proConf , proBc .CurrentBlock (), db , 1 , func (i int , gen * BlockGen ) {})
109+ blocks , _ = GenerateChain (& proConf , proBc .CurrentBlock (), db , 1 , func (i int , gen * BlockGen ) {})
102110 if _ , err := proBc .InsertChain (blocks ); err != nil {
103111 t .Fatalf ("pro-fork chain didn't accepted pro-fork block: %v" , err )
104112 }
105113 }
106114 // Verify that contra-forkers accept pro-fork extra-datas after forking finishes
107115 db , _ = ethdb .NewMemDatabase ()
108116 gspec .MustCommit (db )
109- bc , _ := NewBlockChain (db , conConf , ethash .NewFaker (), vm.Config {})
117+ bc , _ := NewBlockChain (db , & conConf , ethash .NewFaker (), vm.Config {})
110118 defer bc .Stop ()
111119
112120 blocks := conBc .GetBlocksFromHash (conBc .CurrentBlock ().Hash (), int (conBc .CurrentBlock ().NumberU64 ()))
@@ -116,14 +124,14 @@ func TestDAOForkRangeExtradata(t *testing.T) {
116124 if _ , err := bc .InsertChain (blocks ); err != nil {
117125 t .Fatalf ("failed to import contra-fork chain for expansion: %v" , err )
118126 }
119- blocks , _ = GenerateChain (proConf , conBc .CurrentBlock (), db , 1 , func (i int , gen * BlockGen ) {})
127+ blocks , _ = GenerateChain (& proConf , conBc .CurrentBlock (), db , 1 , func (i int , gen * BlockGen ) {})
120128 if _ , err := conBc .InsertChain (blocks ); err != nil {
121129 t .Fatalf ("contra-fork chain didn't accept pro-fork block post-fork: %v" , err )
122130 }
123131 // Verify that pro-forkers accept contra-fork extra-datas after forking finishes
124132 db , _ = ethdb .NewMemDatabase ()
125133 gspec .MustCommit (db )
126- bc , _ = NewBlockChain (db , proConf , ethash .NewFaker (), vm.Config {})
134+ bc , _ = NewBlockChain (db , & proConf , ethash .NewFaker (), vm.Config {})
127135 defer bc .Stop ()
128136
129137 blocks = proBc .GetBlocksFromHash (proBc .CurrentBlock ().Hash (), int (proBc .CurrentBlock ().NumberU64 ()))
@@ -133,7 +141,7 @@ func TestDAOForkRangeExtradata(t *testing.T) {
133141 if _ , err := bc .InsertChain (blocks ); err != nil {
134142 t .Fatalf ("failed to import pro-fork chain for expansion: %v" , err )
135143 }
136- blocks , _ = GenerateChain (conConf , proBc .CurrentBlock (), db , 1 , func (i int , gen * BlockGen ) {})
144+ blocks , _ = GenerateChain (& conConf , proBc .CurrentBlock (), db , 1 , func (i int , gen * BlockGen ) {})
137145 if _ , err := proBc .InsertChain (blocks ); err != nil {
138146 t .Fatalf ("pro-fork chain didn't accept contra-fork block post-fork: %v" , err )
139147 }
0 commit comments