-
Notifications
You must be signed in to change notification settings - Fork 292
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
blockchain: Optimize reorg to use known status.
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.
- Loading branch information
Showing
4 changed files
with
128 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters