From 78767310d9e5a4692da9af9019410002941c2175 Mon Sep 17 00:00:00 2001 From: Giulio Date: Wed, 11 Dec 2024 16:45:26 +0100 Subject: [PATCH] up-bump alpha6 --- turbo/cli/default_flags.go | 1 + turbo/cli/flags.go | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/turbo/cli/default_flags.go b/turbo/cli/default_flags.go index df05ee1b999..cf9837d68ca 100644 --- a/turbo/cli/default_flags.go +++ b/turbo/cli/default_flags.go @@ -45,6 +45,7 @@ var DefaultFlags = []cli.Flag{ &utils.TxPoolCommitEveryFlag, &PruneDistanceFlag, &PruneBlocksDistanceFlag, + &PruneKeepAllBlocksFlag, &PruneModeFlag, &BatchSizeFlag, &BodyCacheLimitFlag, diff --git a/turbo/cli/flags.go b/turbo/cli/flags.go index 25c1499f82a..dcb20ad8641 100644 --- a/turbo/cli/flags.go +++ b/turbo/cli/flags.go @@ -95,9 +95,13 @@ var ( Name: "prune.distance", Usage: `Keep state history for the latest N blocks (default: everything)`, } + PruneKeepAllBlocksFlag = cli.BoolFlag{ + Name: "prune.keep-all-blocks", + Usage: `Keep the entire block history.`, + } PruneBlocksDistanceFlag = cli.Uint64Flag{ Name: "prune.distance.blocks", - Usage: `Keep block history for the latest N blocks (default: everything)`, + Usage: `Keep block history for the latest N blocks (default: pre-merge history)`, } ExperimentsFlag = cli.StringFlag{ Name: "experiments", @@ -450,7 +454,16 @@ func ApplyFlagsForEthConfigCobra(f *pflag.FlagSet, cfg *ethconfig.Config) { default: utils.Fatalf("error: --prune.mode must be one of archive, full, minimal") } - mode.Blocks = prune.Distance(blockDistance) + + var keepAllBlocks bool + keepAllBlocksFlagVal := f.Bool(PruneKeepAllBlocksFlag.Name, PruneKeepAllBlocksFlag.Value, PruneKeepAllBlocksFlag.Usage) + if keepAllBlocksFlagVal != nil { + keepAllBlocks = *keepAllBlocksFlagVal + } + + if keepAllBlocks || blockDistance != math.MaxUint64 { + mode.Blocks = prune.Distance(blockDistance) + } mode.History = prune.Distance(distance) cfg.Prune = mode