blockchain: Add IsAncestor method to blockNode#2153
Merged
Roasbeef merged 2 commits intobtcsuite:masterfrom Apr 10, 2024
Merged
blockchain: Add IsAncestor method to blockNode#2153Roasbeef merged 2 commits intobtcsuite:masterfrom
Roasbeef merged 2 commits intobtcsuite:masterfrom
Conversation
Pull Request Test Coverage Report for Build 8597216282Details
💛 - Coveralls |
Roasbeef
requested changes
Apr 3, 2024
Member
Roasbeef
left a comment
There was a problem hiding this comment.
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.
Crypt-iQ
reviewed
Apr 4, 2024
Collaborator
Crypt-iQ
left a comment
There was a problem hiding this comment.
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
asheswook
pushed a commit
to asheswook/btcd
that referenced
this pull request
Apr 2, 2026
…ancestor blockchain: Add IsAncestor method to blockNode
This file contains hidden or 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
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.
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.