1
0
Fork 0
forked from forks/go-ethereum

cmd/geth: print crit log if chain config is not compatible (#31743)

This commit is contained in:
zhiqiangxu 2025-04-30 11:00:17 +08:00 committed by GitHub
parent 947fd3a834
commit ba0a61bc28
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -246,10 +246,13 @@ func initGenesis(ctx *cli.Context) error {
triedb := utils.MakeTrieDatabase(ctx, chaindb, ctx.Bool(utils.CachePreimagesFlag.Name), false, genesis.IsVerkle())
defer triedb.Close()
_, hash, _, err := core.SetupGenesisBlockWithOverride(chaindb, triedb, genesis, &overrides)
_, hash, compatErr, err := core.SetupGenesisBlockWithOverride(chaindb, triedb, genesis, &overrides)
if err != nil {
utils.Fatalf("Failed to write genesis block: %v", err)
}
if compatErr != nil {
utils.Fatalf("Failed to write chain config: %v", err)
}
log.Info("Successfully wrote genesis state", "database", "chaindata", "hash", hash)
return nil