trie/triedb/pathdb: fix initialization flaws #28715
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.
Fix for #28713
Original problem was caused by #28595 . In this PR, we made it so that as soon as we start to sync, we delete the root of the disk layer. That is not wrong per se, but, another part of the code uses the "presence of the root" as an init-check for the pathdb. And, since the init-check now failed, it tried to initialize it, which failed since a sync was already ongoing.
Impact: after a state-sync has begun, if the node is restarted, it will refuse to restart, with the error message:
Fatal: Failed to register the Ethereum service: waiting for sync.Fix courtesy of @rjl493456442 : we now extend the init-check, so that detect that "yes, it's already initalized, and a sync is ongoing".
There's an additional fix also, which I ran into when doing a guerilla partial-wipe by keeping the ancient folder but deleting chaindata. It would not allow pruning the state histories back to zero.