core: sanity-check fork configuration in genesis init

This commit is contained in:
Felix Lange 2025-02-13 10:48:49 +01:00
parent da71839a27
commit d39546d765

View file

@ -364,6 +364,11 @@ func SetupGenesisBlockWithOverride(db ethdb.Database, triedb *triedb.Database, g
}
newCfg := genesis.chainConfigOrDefault(ghash, storedCfg)
// Sanity-check the new configuration.
if err := newCfg.CheckConfigForkOrder(); err != nil {
return nil, common.Hash{}, nil, err
}
// TODO(rjl493456442) better to define the comparator of chain config
// and short circuit if the chain config is not changed.
compatErr := storedCfg.CheckCompatible(newCfg, head.Number.Uint64(), head.Time)