use head (not header_head) when rewinding full blocks #3017
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.
Resolves #3016
This was nasty.
We fixed the rewind behavior in #3005 to rewind based on the
header_head
when rewinding the header MMR.But this has now exposed a lingering issue when processing full blocks. We now need to rewind the txhashset MMRs (output, rangeproof, kernel) based on the chain
head
itself, not the head of the header MMR.99% of the time these are consistent and this issue does not surface.
But if
head
andheader_head
diverge due to processing "header first" on a previous block we need to then be very careful with -head_head
to rewind the header MMR (as in Fix invalid root #3005)head
to rewind the txhashet MMRs (resolved in this PR)Reworked the test coverage from #3005 and added additional test scenarios to exercise the problem seen in #3016.