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

[2.x.x] Fix check_known logic for blocks/headers #2943

Merged
merged 1 commit into from
Jul 11, 2019

Conversation

antiochp
Copy link
Member

@antiochp antiochp commented Jul 10, 2019

We made some recent changes (on the 2.x.x branch) to how we check for "known" blocks when processing headers in the block processing pipeline - #2834

This introduced a subtle bug in how we process full blocks.

Processing a full block that is an orphan (processed out of order, not yet processed the previous block) will add the block the the "orphan block pool".
When checking for "known" blocks we would look in the orphan block pool in addition to the db.

#2834 changed how we process block headers to use the same "known" rules as full blocks - the rationale being we processed headers as part of processing full blocks and we cared about full blocks themselves. Processing a header could stop early if we know we already processed the full block.

But - we do not want to halt processing a header if the block is known via the orphan pool. It has not yet been processed successfully.

This PR changes the check_known rules to only look in the db (and the current head, itself in the db). We already handle "orphan" blocks in a performant way by looking for the previous block (in the db). We don not need to inspect the "block orphan pool" when checking if we have seen a block before. We only want to use the orphan pool when seeing if we can now process ex-orphans (which we are already doing).

@antiochp antiochp added the bug label Jul 10, 2019
@antiochp antiochp added this to the 2.x.x milestone Jul 10, 2019
@antiochp
Copy link
Member Author

Going to merge this on 2.x.x.

@antiochp antiochp merged commit 2348214 into mimblewimble:milestone/2.x.x Jul 11, 2019
@antiochp antiochp deleted the fix_check_known branch July 11, 2019 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant