@@ -188,10 +188,11 @@ func SetupGenesisBlock(db ethdb.Database, genesis *Genesis) (*params.ChainConfig
188
188
}
189
189
return newcfg , stored , err
190
190
}
191
- // Special case: don't change the existing config of a non-mainnet chain if no new
191
+
192
+ // Special case: don't change the existing config of a non-xinfin chain if no new
192
193
// config is supplied. These chains would get AllProtocolChanges (and a compat error)
193
194
// if we just continued here.
194
- if genesis == nil && stored != params .MainnetGenesisHash {
195
+ if genesis == nil && newcfg == params .AllEthashProtocolChanges {
195
196
return storedcfg , stored , nil
196
197
}
197
198
@@ -211,12 +212,19 @@ func SetupGenesisBlock(db ethdb.Database, genesis *Genesis) (*params.ChainConfig
211
212
func (g * Genesis ) configOrDefault (ghash common.Hash ) * params.ChainConfig {
212
213
switch {
213
214
case g != nil :
215
+ log .Info ("[configOrDefault] load orignal config" , "hash" , ghash )
214
216
return g .Config
215
- case ghash == params .MainnetGenesisHash :
217
+ case ghash == params .XDCMainnetGenesisHash :
218
+ log .Info ("[configOrDefault] load mainnetconfig" )
216
219
return params .XDCMainnetChainConfig
217
220
case ghash == params .TestnetGenesisHash :
221
+ log .Info ("[configOrDefault] load TestnetChainConfig" )
218
222
return params .TestnetChainConfig
223
+ case ghash == params .DevnetGenesisHash :
224
+ log .Info ("[configOrDefault] load DevnetChainConfig" )
225
+ return params .DevnetChainConfig
219
226
default :
227
+ log .Info ("[configOrDefault] load AllEthashProtocolChanges" , "hash" , ghash )
220
228
return params .AllEthashProtocolChanges
221
229
}
222
230
}
@@ -312,26 +320,31 @@ func GenesisBlockForTesting(db ethdb.Database, addr common.Address, balance *big
312
320
313
321
// DefaultGenesisBlock returns the Ethereum main net genesis block.
314
322
func DefaultGenesisBlock () * Genesis {
323
+ config := params .XDCMainnetChainConfig
324
+ config .XDPoS .V2 = nil
315
325
return & Genesis {
316
- Config : params . XDCMainnetChainConfig ,
326
+ Config : config ,
317
327
Nonce : 0 ,
318
- ExtraData : hexutil .MustDecode ("0x00000000000000000000000000000000000000000000000000000000000000001b82c4bf317fcafe3d77e8b444c82715d216afe845b7bd987fa22c9bac89b71f0ded03f6e150ba31ad670b2b166684657ffff95f4810380ae7381e9bce41231d5dd8cdd7499e418b648c00af75d184a2f9aba09a6fa4a46fb1a6a3919b027d9cac5aa6890000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 " ),
328
+ ExtraData : hexutil .MustDecode ("0x000000000000000000000000000000000000000000000000000000000000000025c65b4b379ac37cf78357c4915f73677022eaffc7d49d0a2cf198deebd6ce581af465944ec8b2bbcfccdea1006a5cfa7d9484b5b293b46964c265c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 " ),
319
329
GasLimit : 4700000 ,
320
330
Difficulty : big .NewInt (1 ),
321
- Alloc : DecodeMainnet ( ),
322
- Timestamp : 1544771829 ,
331
+ Alloc : DecodeAllocJson ( XDCAllocData ),
332
+ Timestamp : 1559211559 ,
323
333
}
324
334
}
325
335
326
336
// DefaultTestnetGenesisBlock returns the Ropsten network genesis block.
327
337
func DefaultTestnetGenesisBlock () * Genesis {
338
+ config := params .TestnetChainConfig
339
+ config .XDPoS .V2 = nil
328
340
return & Genesis {
329
341
Config : params .TestnetChainConfig ,
330
- Nonce : 66 ,
331
- ExtraData : hexutil .MustDecode ("0x3535353535353535353535353535353535353535353535353535353535353535" ),
332
- GasLimit : 16777216 ,
333
- Difficulty : big .NewInt (1048576 ),
334
- Alloc : decodePrealloc (testnetAllocData ),
342
+ Nonce : 0 ,
343
+ ExtraData : hexutil .MustDecode ("0x00000000000000000000000000000000000000000000000000000000000000003ea0a3555f9b1de983572bff6444aeb1899ec58c4f7900282f3d371d585ab1361205b0940ab1789c942a5885a8844ee5587c8ac5e371fc39ffe618960000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ),
344
+ GasLimit : 4700000 ,
345
+ Difficulty : big .NewInt (1 ),
346
+ Alloc : DecodeAllocJson (XDCTestAllocData ),
347
+ Timestamp : 1560417871 ,
335
348
}
336
349
}
337
350
@@ -386,8 +399,8 @@ func decodePrealloc(data string) GenesisAlloc {
386
399
return ga
387
400
}
388
401
389
- func DecodeMainnet ( ) GenesisAlloc {
390
- mainnetAlloc := GenesisAlloc {}
391
- json .Unmarshal ([]byte (XDCAllocData ), & mainnetAlloc )
392
- return mainnetAlloc
402
+ func DecodeAllocJson ( s string ) GenesisAlloc {
403
+ alloc := GenesisAlloc {}
404
+ json .Unmarshal ([]byte (s ), & alloc )
405
+ return alloc
393
406
}
0 commit comments