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

multi: Decouple orphan handling from blockchain. #2008

Merged
merged 1 commit into from
Dec 6, 2019

Commits on Dec 6, 2019

  1. multi: Decouple orphan handling from blockchain.

    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 committed Dec 6, 2019
    Configuration menu
    Copy the full SHA
    f140d33 View commit details
    Browse the repository at this point in the history