Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Account for the utxo rewind when attempting to fix a bad chain init #3229

Merged
merged 1 commit into from
Feb 14, 2020

Conversation

antiochp
Copy link
Member

We have a rudimentary "recovery" mechanism on chain init during startup.

We read the current chain head from the db, then check if the chain is valid at that point.
If not we "rewind" to the previous header, reset the chain head and try again.

The existing impl was not taking the UTXO set fully into consideration during this "rewind" and was simply resetting the head back to the previous header.

This PR fixes this and forces an explicit chain rewind via a txhashset extension. This will attempt to revert the UTXO set back to the correct state at the previous header before resetting the chain head.

This is still not perfect and will not "un-corrupt" a corrupted UTXO leafset but it should cover more edge cases and make chain init slightly more robust.

Copy link
Member

@quentinlesceller quentinlesceller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good 👍

@antiochp antiochp merged commit 3c040b9 into mimblewimble:master Feb 14, 2020
@antiochp antiochp deleted the robust_chain_init branch February 14, 2020 15:03
@antiochp antiochp mentioned this pull request Feb 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants