|
|
@ -152,6 +152,10 @@ func (e *GenesisMismatchError) Error() string { |
|
|
|
//
|
|
|
|
//
|
|
|
|
// The returned chain configuration is never nil.
|
|
|
|
// The returned chain configuration is never nil.
|
|
|
|
func SetupGenesisBlock(db ethdb.Database, genesis *Genesis) (*params.ChainConfig, common.Hash, error) { |
|
|
|
func SetupGenesisBlock(db ethdb.Database, genesis *Genesis) (*params.ChainConfig, common.Hash, error) { |
|
|
|
|
|
|
|
return SetupGenesisBlockWithOverride(db, genesis, nil) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func SetupGenesisBlockWithOverride(db ethdb.Database, genesis *Genesis, overrideIstanbul *big.Int) (*params.ChainConfig, common.Hash, error) { |
|
|
|
if genesis != nil && genesis.Config == nil { |
|
|
|
if genesis != nil && genesis.Config == nil { |
|
|
|
return params.AllEthashProtocolChanges, common.Hash{}, errGenesisNoConfig |
|
|
|
return params.AllEthashProtocolChanges, common.Hash{}, errGenesisNoConfig |
|
|
|
} |
|
|
|
} |
|
|
@ -200,6 +204,9 @@ func SetupGenesisBlock(db ethdb.Database, genesis *Genesis) (*params.ChainConfig |
|
|
|
|
|
|
|
|
|
|
|
// Get the existing chain configuration.
|
|
|
|
// Get the existing chain configuration.
|
|
|
|
newcfg := genesis.configOrDefault(stored) |
|
|
|
newcfg := genesis.configOrDefault(stored) |
|
|
|
|
|
|
|
if overrideIstanbul != nil { |
|
|
|
|
|
|
|
newcfg.IstanbulBlock = overrideIstanbul |
|
|
|
|
|
|
|
} |
|
|
|
storedcfg := rawdb.ReadChainConfig(db, stored) |
|
|
|
storedcfg := rawdb.ReadChainConfig(db, stored) |
|
|
|
if storedcfg == nil { |
|
|
|
if storedcfg == nil { |
|
|
|
log.Warn("Found genesis block without chain config") |
|
|
|
log.Warn("Found genesis block without chain config") |
|
|
|