mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 05:36:46 +00:00
core: don't overwrite stored chain config with default based on genesis hash
This commit is contained in:
parent
2872242045
commit
a49766cb23
1 changed files with 6 additions and 21 deletions
|
|
@ -364,7 +364,12 @@ func SetupGenesisBlockWithOverride(db ethdb.Database, triedb *triedb.Database, g
|
||||||
if head == nil {
|
if head == nil {
|
||||||
return nil, common.Hash{}, nil, errors.New("missing head header")
|
return nil, common.Hash{}, nil, errors.New("missing head header")
|
||||||
}
|
}
|
||||||
newCfg := genesis.chainConfigOrDefault(ghash, storedCfg)
|
// The new config is sourced either directly from provided Genesis or by
|
||||||
|
// applying overrides to the stored config.
|
||||||
|
newCfg := storedCfg
|
||||||
|
if genesis != nil {
|
||||||
|
newCfg = genesis.Config
|
||||||
|
}
|
||||||
if err := overrides.apply(newCfg); err != nil {
|
if err := overrides.apply(newCfg); err != nil {
|
||||||
return nil, common.Hash{}, nil, err
|
return nil, common.Hash{}, nil, err
|
||||||
}
|
}
|
||||||
|
|
@ -423,26 +428,6 @@ func LoadChainConfig(db ethdb.Database, genesis *Genesis) (cfg *params.ChainConf
|
||||||
return params.MainnetChainConfig, params.MainnetGenesisHash, nil
|
return params.MainnetChainConfig, params.MainnetGenesisHash, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// chainConfigOrDefault retrieves the attached chain configuration. If the genesis
|
|
||||||
// object is null, it returns the default chain configuration based on the given
|
|
||||||
// genesis hash, or the locally stored config if it's not a pre-defined network.
|
|
||||||
func (g *Genesis) chainConfigOrDefault(ghash common.Hash, stored *params.ChainConfig) *params.ChainConfig {
|
|
||||||
switch {
|
|
||||||
case g != nil:
|
|
||||||
return g.Config
|
|
||||||
case ghash == params.MainnetGenesisHash:
|
|
||||||
return params.MainnetChainConfig
|
|
||||||
case ghash == params.HoleskyGenesisHash:
|
|
||||||
return params.HoleskyChainConfig
|
|
||||||
case ghash == params.SepoliaGenesisHash:
|
|
||||||
return params.SepoliaChainConfig
|
|
||||||
case ghash == params.HoodiGenesisHash:
|
|
||||||
return params.HoodiChainConfig
|
|
||||||
default:
|
|
||||||
return stored
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// IsVerkle indicates whether the state is already stored in a verkle
|
// IsVerkle indicates whether the state is already stored in a verkle
|
||||||
// tree at genesis time.
|
// tree at genesis time.
|
||||||
func (g *Genesis) IsVerkle() bool {
|
func (g *Genesis) IsVerkle() bool {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue