-
Notifications
You must be signed in to change notification settings - Fork 296
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
multi: Decouple orphan handling from blockchain. #2008
Merged
davecgh
merged 1 commit into
decred:master
from
davecgh:blockchain_decouple_orphan_handling
Dec 6, 2019
Merged
multi: Decouple orphan handling from blockchain. #2008
davecgh
merged 1 commit into
decred:master
from
davecgh:blockchain_decouple_orphan_handling
Dec 6, 2019
Conversation
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
matheusd
reviewed
Nov 22, 2019
matheusd
approved these changes
Nov 22, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Working fine now, thanks!
davecgh
force-pushed
the
blockchain_decouple_orphan_handling
branch
from
November 27, 2019 04:34
350e4bf
to
0e25aa9
Compare
dnldd
reviewed
Dec 2, 2019
davecgh
force-pushed
the
blockchain_decouple_orphan_handling
branch
from
December 3, 2019 06:41
0e25aa9
to
5db810a
Compare
dajohi
approved these changes
Dec 3, 2019
This decouples and removes the orphan handling from blockchain in favor of implementing it in the block manager as part of the overall effort to decouple the connection code from the download logic. The change might not make a ton of sense in isolation, since there is no major functional change, however, decoupling the orphan handling independently helps make the review process easier and alleviates what would otherwise result in additional intermediate code to handle cases that ultimately will no longer exist. The following is a high level overview of the changes: - Introduce blockchain function to more easily determine if an error is a rule error with a given error code - Move core orphan handling code from blockchain to block manager - Move data structures used to cache and track orphan blocks - Move all functions releated to orphans - BlockChain.IsKnownOrphan -> blockManager.isKnownOrphan - BlockChain.GetOrphanRoot -> blockManager.orphanRoot - BlockChain.removeOrphanBlock -> blockManager.removeOrphanBlock - BlockChain.addOrphanBlock -> blockManager.addOrphanBlock - Implement orphan handling in block manager - Rework to use the moved functions and data structs - Add check for known orphans in addition HaveBlock calls to retain the same behavior - Modify the semantics of the process block func exposed by the block manager so that it no longer stores orphans since all consumers of it ultimately reject orphans anyway - Remove remaining orphan related code from blockchain - Update ProcessBlock to return an error when called with an orphan - Remove additional orphan processing from ProcessBlock - Remove orphan cache check from HaveBlock - Adjust example to account for the removed parameter - Change chaingen harness tests to detect orphans via returned error - Modify fullblock tests to detect orphans via returned error - Adapt process order logic tests to cope with lack of orphan processing - Update all other tests accordingly - Update various comments and the README.md and doc.go to properly reflect the removal of orphan handling
davecgh
force-pushed
the
blockchain_decouple_orphan_handling
branch
from
December 6, 2019 03:39
5db810a
to
f140d33
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This decouples and removes the orphan handling from blockchain in favor of implementing it in the block manager as part of the overall effort to decouple the connection code from the download logic.
The change might not make a ton of sense in isolation, since there is no major functional change, however, decoupling the orphan handling independently helps make the review process easier and alleviates what would otherwise result in additional intermediate code to handle cases that ultimately will no longer exist.
The following is a high level overview of the changes:
BlockChain.IsKnownOrphan
->blockManager.isKnownOrphan
BlockChain.GetOrphanRoot
->blockManager.orphanRoot
BlockChain.removeOrphanBlock
->blockManager.removeOrphanBlock
BlockChain.addOrphanBlock
->blockManager.addOrphanBlock
HaveBlock
calls to retain the same behaviorProcessBlock
to return an error when called with an orphanProcessBlock
HaveBlock
chaingen
harness tests to detect orphans via returned errorREADME.md
anddoc.go
to properly reflect the removal of orphan handlingThis is work towards #1145.