Skip to content

Commit

Permalink
core: allow for config override on non-mainnet networks
Browse files Browse the repository at this point in the history
  • Loading branch information
MariusVanDerWijden committed Mar 11, 2022
1 parent 2f74d96 commit b951e9c
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions core/genesis.go
Expand Up @@ -203,15 +203,9 @@ func SetupGenesisBlockWithOverride(db ethdb.Database, genesis *Genesis, override
}
}
// Get the existing chain configuration.
overrides := false
newcfg := genesis.configOrDefault(stored)
if overrideArrowGlacier != nil {
newcfg.ArrowGlacierBlock = overrideArrowGlacier
overrides = true
}
if overrideTerminalTotalDifficulty != nil {
newcfg.TerminalTotalDifficulty = overrideTerminalTotalDifficulty
overrides = true
}
if err := newcfg.CheckConfigForkOrder(); err != nil {
return newcfg, common.Hash{}, err
Expand All @@ -222,10 +216,14 @@ func SetupGenesisBlockWithOverride(db ethdb.Database, genesis *Genesis, override
rawdb.WriteChainConfig(db, stored, newcfg)
return newcfg, stored, nil
}

if overrideTerminalTotalDifficulty != nil {
storedcfg.TerminalTotalDifficulty = overrideTerminalTotalDifficulty
}
// Special case: don't change the existing config of a non-mainnet chain if no new
// config is supplied. These chains would get AllProtocolChanges (and a compat error)
// if we just continued here.
if !overrides && genesis == nil && stored != params.MainnetGenesisHash {
if genesis == nil && stored != params.MainnetGenesisHash {
return storedcfg, stored, nil
}
// Check config compatibility and write the config. Compatibility errors
Expand Down

0 comments on commit b951e9c

Please sign in to comment.