Skip to content

Commit f9cc307

Browse files
committed
core: return locally stored chain config if exists
1 parent caf1b2a commit f9cc307

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

core/genesis.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -432,12 +432,14 @@ func LoadChainConfig(db ethdb.Database, genesis *Genesis) (cfg *params.ChainConf
432432
}
433433

434434
// chainConfigOrDefault retrieves the attached chain configuration. If the genesis
435-
// object is null, it returns the default chain configuration based on the given
436-
// genesis hash, or the locally stored config if it's not a pre-defined network.
435+
// object is nil, it returns the locally stored configuration if available;
436+
// otherwise, it returns the default configuration for the predefined testnets.
437437
func (g *Genesis) chainConfigOrDefault(ghash common.Hash, stored *params.ChainConfig) *params.ChainConfig {
438438
switch {
439439
case g != nil:
440440
return g.Config
441+
case stored != nil:
442+
return stored
441443
case ghash == params.MainnetGenesisHash:
442444
return params.MainnetChainConfig
443445
case ghash == params.HoleskyGenesisHash:
@@ -446,9 +448,8 @@ func (g *Genesis) chainConfigOrDefault(ghash common.Hash, stored *params.ChainCo
446448
return params.SepoliaChainConfig
447449
case ghash == params.HoodiGenesisHash:
448450
return params.HoodiChainConfig
449-
default:
450-
return stored
451451
}
452+
return nil
452453
}
453454

454455
// IsVerkle indicates whether the state is already stored in a verkle

0 commit comments

Comments
 (0)