-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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: Add IsAncestor method to blockNode #2153
blockchain: Add IsAncestor method to blockNode #2153
Conversation
Pull Request Test Coverage Report for Build 8597216282Details
💛 - Coveralls |
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.
Nice addition! Mostly straight forward to follow, though I'm concerned that the equality check is done using pointers, rather than the value itself. Eg: if we make a new instance or copy of otherNode
(that's already in the index, and is an ancestor of node
), then from my reading we'll return false
, when we should return true
.
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.
Looks good once laolu's comments addressed. One nit in the test
Helper function for the added IsAncestor in the follow up commit. Returns true if all the fields (except for parent and ancestor) are equal.
IsAncestor() provides functionality for testing if a block node is an ancestor of anther block node.
89ec64e
to
bc6396d
Compare
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.
LGTM 📣
IsAncestor() provides functionality for testing if a block node is an ancestor of anther block node.
Cherry-picked from 0d6a93e687e3470608cccfc58cc4a2ddb5ea8262.
It's a part of #2154 as this method is used in utreexod code for testing invalidateblock and reconsiderblock methods on blockchain.