diff --git a/cmd/geth/chaincmd.go b/cmd/geth/chaincmd.go index 55c22f7322f3..2179b61032b6 100644 --- a/cmd/geth/chaincmd.go +++ b/cmd/geth/chaincmd.go @@ -214,7 +214,7 @@ func initGenesis(ctx *cli.Context) error { } triedb := trie.NewDatabaseWithConfig(chaindb, &trie.Config{ Preimages: ctx.Bool(utils.CachePreimagesFlag.Name), - Verkle: true, + Verkle: genesis.IsVerkle(), }) _, hash, err := core.SetupGenesisBlockWithOverride(chaindb, triedb, genesis, &overrides) if err != nil { diff --git a/core/genesis.go b/core/genesis.go index 74294afb7272..e6874039f2e2 100644 --- a/core/genesis.go +++ b/core/genesis.go @@ -456,6 +456,12 @@ func (g *Genesis) configOrDefault(ghash common.Hash) *params.ChainConfig { } } +// IsVerkle indicates whether the state is already stored in a verkle +// tree at genesis time. +func (g *Genesis) IsVerkle() bool { + return g.Config.IsPrague(new(big.Int).SetUint64(g.Number), g.Timestamp) +} + // ToBlock returns the genesis block according to genesis specification. func (g *Genesis) ToBlock() *types.Block { root, err := g.Alloc.deriveHash(g.Config, g.Timestamp)