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

Remove invalid headers on chain repair #1856

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

kushti
Copy link
Member

@kushti kushti commented Oct 1, 2022

Unlike previous attempts to repair db of node being stuck, this one is removing invalid blocks in the past (in 128 blocks depth from the tip) and in future (not just the next height).

Could be useful to unstuck with pre 4,0,100 databases stuck after the HF.

@kushti kushti requested a review from pragmaxim October 1, 2022 22:59
}
if(updatedHeightIdsValue.isEmpty) {
//could be the case after bestHeaderHeight
history.historyStorage.remove(Array(history.heightIdsKey(h)), Nil)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't we also remove the Modifier at this height? Not just index? Or is there an idempotency in place that the modifer gets overriden if index is empty?

//could be the case after bestHeaderHeight
history.historyStorage.remove(Array(history.heightIdsKey(h)), Nil)
} else {
history.historyStorage.insert(Array(history.heightIdsKey(h) -> updatedHeightIdsValue), Nil)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't understand what we are updating the valid header index with and why, that would need at least a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants