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: Simplify blocknode construction. #1056

Merged

Conversation

davecgh
Copy link
Member

@davecgh davecgh commented Feb 18, 2018

This requires PR #1057. (now merged)

This consists of two commits to simplify the construction logic for block nodes.

The first separates the logic for populating the stake information in a block node from the construction of the node in order to better delineate the difference between the two and to pave the way for that information to be stored separately in the database versus needing to load full blocks to retrieve it.

The second modifies the newBlockNode function to accept the parent as an argument to automatically connect the newly created node. When it is not nil, the work sum will automatically be summed and the parent of the new node will be set accordingly. This simplifies the block node construction a bit and allows some redundant code to be removed. It also paves the way for easier simpler full block index construction in the future.

@davecgh davecgh force-pushed the blockchain_simplify_blocknode_construction branch 2 times, most recently from 1ce9943 to 31d500a Compare February 19, 2018 01:57
This separates the logic for populating the stake information in a block
node from the construction of the node in order to better delineate the
difference between the two and to pave the way for that information to
be stored separately in the database versus needing to load full blocks
to retrieve it.
This modifies the newBlockNode function to accept the parent as an
argument to automatically connect the newly created node.  When it is
not nil, the work sum will automatically be summed and the parent of the
new node will be set accordingly.

This simplifies the block node construction a bit and allows some
redundant code to be removed.  It also paves the way for easier simpler
full block index construction in the future.
@davecgh davecgh force-pushed the blockchain_simplify_blocknode_construction branch from 31d500a to cb40146 Compare February 19, 2018 02:45
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

Copy link
Member

@alexlyp alexlyp left a comment

Choose a reason for hiding this comment

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

tACK

@davecgh davecgh merged commit cb40146 into decred:master Feb 19, 2018
@davecgh davecgh deleted the blockchain_simplify_blocknode_construction branch February 19, 2018 16:04
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

3 participants