From d39546d7656bdee9d6c3ccab021ffb1fea96bdc1 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Thu, 13 Feb 2025 10:48:49 +0100 Subject: [PATCH] core: sanity-check fork configuration in genesis init --- core/genesis.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/genesis.go b/core/genesis.go index 8546f4e37e..4dd6c9ed24 100644 --- a/core/genesis.go +++ b/core/genesis.go @@ -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)