diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 5e96185dbd03..94c6ce9e3407 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -1865,6 +1865,7 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) { cfg.Miner.GasPrice = big.NewInt(1) } default: + cfg.Genesis = core.DefaultGenesisBlock() if cfg.NetworkId == 1 { SetDNSDiscoveryDefaults(cfg, params.MainnetGenesisHash) } diff --git a/core/genesis.go b/core/genesis.go index 13d4addd7e7b..9cf56e96cc08 100644 --- a/core/genesis.go +++ b/core/genesis.go @@ -364,7 +364,12 @@ func SetupGenesisBlockWithOverride(db ethdb.Database, triedb *triedb.Database, g if head == nil { 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 { 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 } -// 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 // tree at genesis time. func (g *Genesis) IsVerkle() bool {