diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index c41cf4ee40..25be9f8d85 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -1841,7 +1841,7 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) { log.Warn("The flag --txlookuplimit is deprecated and will be removed, please use --history.transactions") cfg.TransactionHistory = ctx.Uint64(TxLookupLimitFlag.Name) } - if ctx.String(GCModeFlag.Name) == "archive" { + if cfg.NoPruning { if cfg.TransactionHistory != 0 { cfg.TransactionHistory = 0 log.Warn("Disabled transaction unindexing for archive node") @@ -2434,7 +2434,6 @@ func MakeChain(ctx *cli.Context, stack *node.Node, readonly bool) (*core.BlockCh TrieCleanLimit: ethconfig.Defaults.TrieCleanCache, NoPrefetch: ctx.Bool(CacheNoPrefetchFlag.Name), TrieDirtyLimit: ethconfig.Defaults.TrieDirtyCache, - ArchiveMode: ctx.String(GCModeFlag.Name) == "archive", TrieTimeLimit: ethconfig.Defaults.TrieTimeout, SnapshotLimit: ethconfig.Defaults.SnapshotCache, Preimages: ctx.Bool(CachePreimagesFlag.Name), @@ -2459,6 +2458,9 @@ func MakeChain(ctx *cli.Context, stack *node.Node, readonly bool) (*core.BlockCh // Configure the slow block statistic logger (disabled by default) SlowBlockThreshold: ethconfig.Defaults.SlowBlockThreshold, } + if ctx.IsSet(GCModeFlag.Name) { + options.ArchiveMode = ctx.String(GCModeFlag.Name) == "archive" + } // Only enable slow block logging if the flag was explicitly set if ctx.IsSet(LogSlowBlockFlag.Name) { options.SlowBlockThreshold = ctx.Duration(LogSlowBlockFlag.Name)