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: Explicit block fetch semantics. #999

Merged

Conversation

davecgh
Copy link
Member

@davecgh davecgh commented Jan 31, 2018

This requires #998.

This makes the semantics of block fetching much more explicit by introducing a new function named fetchMainChainBlockByHash which only attempts to the load a block from the main chain block cache and then falls back to the database. While currently only blocks in the main chain are in the database, the intention is for future commits to allow the database to house side chain blocks as well, so having clearly defined semantics will help make that transition easier to verify.

While here, it also renames {f,F}etchBlockFromHash to {f,F}etchBlockByHash to be consistent with the naming used by the other existing functions and updates the comments to better describe the function semantics.

@davecgh davecgh force-pushed the blockchain_explicit_fetchblock_semantics branch from 6eb9836 to 4b0a9ae Compare January 31, 2018 12:53
Copy link
Contributor

@jolan jolan left a comment

Choose a reason for hiding this comment

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

tOK

@davecgh davecgh force-pushed the blockchain_explicit_fetchblock_semantics branch from 4b0a9ae to cfe328b Compare January 31, 2018 18:36
This makes the semantics of block fetching much more explicit by
introducing a new function named fetchMainChainBlockByHash which only
attempts to the load a block from the main chain block cache and then
falls back to the database.  While currently only blocks in the main
chain are in the database, the intention is for future commits to
allow the database to house side chain blocks as well, so having clearly
defined semantics will help make that transition easier to verify.

While here, it also renames {f,F}etchBlockFromHash to {f,F}etchBlockByHash
to be consistent with the naming used by the other existing functions
and updates the comments to better describe the function semantics.
@davecgh davecgh force-pushed the blockchain_explicit_fetchblock_semantics branch from cfe328b to 31f11b2 Compare January 31, 2018 23:01
@davecgh davecgh merged commit 31f11b2 into decred:master Jan 31, 2018
@davecgh davecgh deleted the blockchain_explicit_fetchblock_semantics branch January 31, 2018 23:45
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.

3 participants