all: recommit genesis state for 0 rewinding target #24450
Closed
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.
Geth will try to rewind its head to a lower point if the corresponding state is not found.
But in order to avoid the unnecessary disk load, if the block is lower than pivot point, then
the state won't be checked, instead genesis block will be used as the destination directly.
In the current code base, the assumption is held that genesis state is always existent in the
disk. However, in the new state scheme(path based), state will always be overwritten and
genesis state can be gone in this case.
This PR wants to get rid of the assumption, but recommit the genesis state instead. theoretically
it should make no difference right now, but this logic can be merged first before the big state PR.
Warning: most of the changes are in the test!