eth: Add --historymode flag for configurable blockchain history pruning FIX #31277 #31325
+141
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Description
This PR adds a new --historymode command-line flag to geth that allows users to configure how blockchain history is retained.
Fix #31277
#31277
Overview
The --historymode flag provides a way to configure how much of the blockchain history is retained by the node. Currently, there are two options:
This flag is conceptually similar to --syncmode and --gcmode, helping users better control disk usage and database size.
Implementation Details
Behavior
When --historymode=pruned is set:
This PR lays the groundwork for eventually making pruned mode the default, which will help reduce disk usage for regular nodes without sacrificing critical functionality.
Testing
The implementation has been tested with various combinations of flags to ensure proper behavior:
Tested on a local blockchain to ensure transaction history and state pruning worked as expected.