@@ -49,7 +49,7 @@ func TestHeaderVerification(t *testing.T) {
4949 headers [i ] = block .Header ()
5050 }
5151 // Run the header checker for blocks one-by-one, checking for both valid and invalid nonces
52- chain , _ := NewBlockChain (testdb , nil , params . TestChainConfig , ethash .NewFaker (), vm.Config {}, nil , nil )
52+ chain , _ := NewBlockChain (testdb , nil , gspec , nil , ethash .NewFaker (), vm.Config {}, nil , nil )
5353 defer chain .Stop ()
5454
5555 for i := 0 ; i < len (blocks ); i ++ {
@@ -89,20 +89,21 @@ func TestHeaderVerificationForMergingEthash(t *testing.T) { testHeaderVerificati
8989// Tests the verification for eth1/2 merging, including pre-merge and post-merge
9090func testHeaderVerificationForMerging (t * testing.T , isClique bool ) {
9191 var (
92- testdb = rawdb .NewMemoryDatabase ()
93- preBlocks []* types.Block
94- postBlocks []* types.Block
95- runEngine consensus.Engine
96- chainConfig * params. ChainConfig
97- merger = consensus .NewMerger (rawdb .NewMemoryDatabase ())
92+ testdb = rawdb .NewMemoryDatabase ()
93+ preBlocks []* types.Block
94+ postBlocks []* types.Block
95+ runEngine consensus.Engine
96+ genspec * Genesis
97+ merger = consensus .NewMerger (rawdb .NewMemoryDatabase ())
9898 )
9999 if isClique {
100100 var (
101101 key , _ = crypto .HexToECDSA ("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291" )
102102 addr = crypto .PubkeyToAddress (key .PublicKey )
103103 engine = clique .New (params .AllCliqueProtocolChanges .Clique , testdb )
104104 )
105- genspec := & Genesis {
105+ genspec = & Genesis {
106+ Config : params .AllCliqueProtocolChanges ,
106107 ExtraData : make ([]byte , 32 + common .AddressLength + crypto .SignatureLength ),
107108 Alloc : map [common.Address ]GenesisAccount {
108109 addr : {Balance : big .NewInt (1 )},
@@ -133,11 +134,11 @@ func testHeaderVerificationForMerging(t *testing.T, isClique bool) {
133134 config := * params .AllCliqueProtocolChanges
134135 config .TerminalTotalDifficulty = big .NewInt (int64 (td ))
135136 postBlocks , _ = GenerateChain (& config , preBlocks [len (preBlocks )- 1 ], genEngine , testdb , 8 , nil )
136- chainConfig = & config
137137 runEngine = beacon .New (engine )
138+ genspec .Config = & config
138139 } else {
139- gspec : = & Genesis {Config : params .TestChainConfig }
140- genesis := gspec .MustCommit (testdb )
140+ genspec = & Genesis {Config : params .TestChainConfig }
141+ genesis := genspec .MustCommit (testdb )
141142 genEngine := beacon .New (ethash .NewFaker ())
142143
143144 preBlocks , _ = GenerateChain (params .TestChainConfig , genesis , genEngine , testdb , 8 , nil )
@@ -150,8 +151,8 @@ func testHeaderVerificationForMerging(t *testing.T, isClique bool) {
150151 config .TerminalTotalDifficulty = big .NewInt (int64 (td ))
151152 postBlocks , _ = GenerateChain (params .TestChainConfig , preBlocks [len (preBlocks )- 1 ], genEngine , testdb , 8 , nil )
152153
153- chainConfig = & config
154154 runEngine = beacon .New (ethash .NewFaker ())
155+ genspec .Config = & config
155156 }
156157
157158 preHeaders := make ([]* types.Header , len (preBlocks ))
@@ -169,7 +170,7 @@ func testHeaderVerificationForMerging(t *testing.T, isClique bool) {
169170 t .Logf ("Log header after the merging %d: %v" , block .NumberU64 (), string (blob ))
170171 }
171172 // Run the header checker for blocks one-by-one, checking for both valid and invalid nonces
172- chain , _ := NewBlockChain (testdb , nil , chainConfig , runEngine , vm.Config {}, nil , nil )
173+ chain , _ := NewBlockChain (testdb , nil , genspec , nil , runEngine , vm.Config {}, nil , nil )
173174 defer chain .Stop ()
174175
175176 // Verify the blocks before the merging
@@ -280,11 +281,11 @@ func testHeaderConcurrentVerification(t *testing.T, threads int) {
280281 var results <- chan error
281282
282283 if valid {
283- chain , _ := NewBlockChain (testdb , nil , params . TestChainConfig , ethash .NewFaker (), vm.Config {}, nil , nil )
284+ chain , _ := NewBlockChain (testdb , nil , gspec , nil , ethash .NewFaker (), vm.Config {}, nil , nil )
284285 _ , results = chain .engine .VerifyHeaders (chain , headers , seals )
285286 chain .Stop ()
286287 } else {
287- chain , _ := NewBlockChain (testdb , nil , params . TestChainConfig , ethash .NewFakeFailer (uint64 (len (headers )- 1 )), vm.Config {}, nil , nil )
288+ chain , _ := NewBlockChain (testdb , nil , gspec , nil , ethash .NewFakeFailer (uint64 (len (headers )- 1 )), vm.Config {}, nil , nil )
288289 _ , results = chain .engine .VerifyHeaders (chain , headers , seals )
289290 chain .Stop ()
290291 }
@@ -347,7 +348,7 @@ func testHeaderConcurrentAbortion(t *testing.T, threads int) {
347348 defer runtime .GOMAXPROCS (old )
348349
349350 // Start the verifications and immediately abort
350- chain , _ := NewBlockChain (testdb , nil , params . TestChainConfig , ethash .NewFakeDelayer (time .Millisecond ), vm.Config {}, nil , nil )
351+ chain , _ := NewBlockChain (testdb , nil , gspec , nil , ethash .NewFakeDelayer (time .Millisecond ), vm.Config {}, nil , nil )
351352 defer chain .Stop ()
352353
353354 abort , results := chain .engine .VerifyHeaders (chain , headers , seals )
0 commit comments