feat: add config to enable block database #4627
Draft
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.
Why this should be merged
Part of #4500, resolves #4629. Adds config options in coreth to persist blocks in separate height-indexed databases instead of the current key-value store. Disabled by default.
How this works
New
corethconfig options:block-database-enabled: When true, stores block header/body/receipts in separate height-indexed databases.skip-block-database-auto-migrate: When true, skips migrating existing blocks from KV DB to the block databases. Only new blocks will be stored.Other Changes:
newChainDBthat creates ablockdb.Databasewrapper when enabled.BlockSyncer.Syncbefore fetching blocks. This sets the min-height to the smaller block height that will be stored.How this was tested
Unit tests & running Mainnet nodes with Block Database enabled.
Need to be documented in RELEASES.md?
Yes