From 623d45a1d2312db0abbd09b0cf006f6ffe8e508d Mon Sep 17 00:00:00 2001 From: Delweng Date: Fri, 27 Jun 2025 23:38:47 +0800 Subject: [PATCH] enable preimage for hash only Signed-off-by: Delweng --- cmd/utils/flags.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 01de680278..6872b6e594 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -1634,9 +1634,11 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) { } // Read the value from the flag no matter if it's set or not. cfg.Preimages = ctx.Bool(CachePreimagesFlag.Name) - if cfg.NoPruning && !cfg.Preimages { + // Only check the user's input for hash mode here; path is the default scheme, + // so we don't need to check the actual database scheme. + if cfg.NoPruning && !cfg.Preimages && ctx.String(StateSchemeFlag.Name) == rawdb.HashScheme { cfg.Preimages = true - log.Info("Enabling recording of key preimages since archive mode is used") + log.Info("Enabling recording of key preimages: required for archive mode with hash state scheme") } if ctx.IsSet(StateHistoryFlag.Name) { cfg.StateHistory = ctx.Uint64(StateHistoryFlag.Name)