Repository navigation
Conversation
bitcoisas
force-pushed
the
psbt-taptree-complete
branch
from
November 23, 2026 17:58
aa8a2f7 to
a3fd77a
Compare
bitcoisas
marked this pull request as ready for review
November 23, 2026 17:59
jgriffiths
reviewed
Nov 23, 2026
taproot_tree_value_verify() checked each leaf but not the tree as a whole, so leaves that don't form a complete binary tree were accepted, while Bitcoin Core rejects them. Track the depths waiting for a sibling and reject trees with a missing sibling, leaves after the tree is complete, or a leaf above an unfinished branch. Fixes ElementsProject#565.
bitcoisas
force-pushed
the
psbt-taptree-complete
branch
from
November 23, 2026 23:52
a3fd77a to
7227257
Compare
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.
Fixes #565.
Follows Bitcoin Core's TaprootBuilder::ValidDepths(): track which depths hold a node waiting for its sibling and reject trees with a missing sibling (1), leaves after the tree is complete (0,0), or a leaf above an unfinished branch (2,1,2).
The valid value in test_taproot_tree was itself incomplete (1,2,128), so it's replaced by a complete tree that still reaches depth 128, and an incomplete tree is now also checked through wally_psbt_from_bytes. The new tests fail without the fix.