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

blockchain: Optimize reorg to use known status. #1367

Merged

Conversation

davecgh
Copy link
Member

@davecgh davecgh commented Jul 21, 2018

This optimizes the chain reorganization logic by making use of the block index status flags for known valid and invalid blocks.

In particular, validation is now skipped for blocks that are either already known valid or invalid. When validating blocks, the result is stored into the block index for the block accordingly, and in the case of blocks that fail validation, all of the descendants of the invalid block are marked as having an invalid ancestor.

It also introduces a new error named ErrKnownInvalidBlock which is returned in the case a forced reorg is attempted to an invalid block and adds a test to ensure it works as intended.

This is work towards #1145.

@davecgh davecgh added this to the 1.3.0 milestone Jul 21, 2018
@davecgh davecgh mentioned this pull request Jul 21, 2018
28 tasks
Copy link
Member

@dajohi dajohi left a comment

Choose a reason for hiding this comment

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

ok testnet2 miner

This optimizes the chain reorganization logic by making use of the
block index status flags for known valid and invalid blocks.

In particular, validation is now skipped for blocks that are either
already known valid or invalid.  When validating blocks, the result is
stored into the block index for the block accordingly, and in the case
of blocks that fail validation, all of the descendants of the invalid
block are marked as having an invalid ancestor.

It also introduces a new error named ErrKnownInvalidBlock which is
returned in the case a forced reorg is attempted to an invalid block and
adds a test to ensure it works as intended.
@davecgh davecgh force-pushed the blockchain_optimize_reorg_known_status branch from 7b0c2bd to 46b081c Compare July 26, 2018 20:20
@davecgh davecgh merged commit 46b081c into decred:master Jul 26, 2018
@davecgh davecgh deleted the blockchain_optimize_reorg_known_status branch July 26, 2018 20:52
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.

None yet

4 participants