1 minor finding · 5 suggestions
Earlier concerns neither republished nor resolved: 1 minor finding · 4 suggestions. See the Run archive for their assessments.
Findings
[minor] · A missing warning does not establish commitment to the spent output
Even with taproot_merkle_root present, no warning establishes only structural consistency with PSBT metadata, whereas the help's absent-root qualification suggests a stronger guarantee.
Location: src/rpc/rawtransaction.cpp:1409 (head).
Details and suggested fix
With a matching declared root, changing a control block's internal-key bytes or parity bit produces no warning. CheckTapLeafCandidate() ignores those bytes and masks off parity, and the root comparison never binds the PSBT metadata to the spent output. These control blocks can therefore pass the diagnostic while failing the BIP341 commitment check used by VerifyTaprootCommitment(). Reword the RPC help and helper documentation to say that omission means only that the listed structural and PSBT-field consistency checks passed, whether or not a root is present. In particular, do not limit the “not a genuine leaf” qualification to the absent-root case. Signing is unchanged, and ProduceSignature() still verifies its constructed witness before marking the input complete.
Optional improvements
[suggestion] · Inference tests omit mixed valid and malformed candidates
Every rejection case removes a valid leaf record first, so the new tests would still pass if inference aborted on a bad candidate instead of skipping it.
Location: src/test/psbt_tests.cpp:355 (head).
Details and suggested fix
check_rejected erases script1's only valid record before inserting its malformed replacement, while the successful fixture contains no malformed candidate. An immediate return of std::nullopt at the new helper call would therefore satisfy every added inference assertion. That would lose the intended behavior of ignoring unusable extras; descriptor inference can then fall back to rawtr(). Keep the complete good fixture, add each malformed candidate alongside its valid records, and assert that both leaves are still inferred. Use an additional control block under the existing key, or a separate key for the odd leaf version. The current production loop correctly skips these candidates.
[suggestion] · Whole-tree rejection does not pin the helper's error categories
The odd-version unit case would still pass without BAD_LEAF_VERSION, and the size fixture tests misalignment rather than the minimum length.
Location: src/test/psbt_tests.cpp:363 (head).
Details and suggested fix
Because TAPROOT_LEAF_MASK is 0xfe, the later leaf-version mismatch check also rejects every odd or out-of-range version. Removing BAD_LEAF_VERSION would therefore leave this unit assertion passing. Also, good_control_block is 65 bytes, so popping one byte produces a misaligned 64-byte block, not one below the 33-byte minimum. Add direct CheckTapLeafCandidate() assertions for its enum results, including odd, -1 and 0x100 versions; undersized, misaligned and oversized blocks; the two mismatch categories; and a root mismatch that becomes NONE with std::nullopt. Update the comment's claim that the checks are independent and its stale reference to the old comments. The functional test already pins the four warning strings reachable through RPC.
[suggestion] · The diagnostic conflates BIP341 leaf versions with tapscript
BAD_LEAF_VERSION checks BIP341's even, in-range leaf-version rule, but its message and enum documentation call this a tapscript-version check.
Location: src/rpc/rawtransaction.cpp:1090 (head).
Details and suggested fix
An even version such as 0xc2 passes this check, although tapscript under BIP342 specifically uses 0xc0. The interpreter only selects tapscript execution for that version. Change the RPC message and enum comment to “leaf version is not a valid BIP341 leaf version (must be even)” and update the functional assertions to match. This clarifies the diagnostic category without changing which inputs pass.
[suggestion] · The new decodepsbt diagnostic has no release note
The optional control_block_warnings field changes user-visible RPC output but has no release note of the kind requested by the developer notes.
Location: src/rpc/rawtransaction.cpp:920 (head).
Details and suggested fix
Add a short doc/release-notes-<PR number>.md entry describing control_block_warnings inside each input's taproot_scripts objects. Note that each entry reports only the first failed check and that the Merkle-root comparison is skipped without taproot_merkle_root. The RPC help already documents the field; the missing piece is release communication so users can discover the new diagnostic.
[suggestion] · An explicit all-zero Merkle root is treated as absent
A serialized 32-byte zero PSBT_IN_TAP_MERKLE_ROOT skips the new comparison, so the comment's “actually carries one” condition is not literal field presence.
Location: src/rpc/rawtransaction.cpp:1398 (head).
Details and suggested fix
PSBT deserialization accepts an explicit zero root but does not retain its presence separately. IsNull() therefore converts it to std::nullopt and skips the root comparison. This follows the existing convention: serialization omits zero roots, FillSignatureData ignores them, and decodepsbt omits taproot_merkle_root, keeping the help consistent with the displayed field. Clarify the new comment to say that zero is treated as absent, and add a functional case using merkle_root=bytes(32) to pin that behavior. Tracking presence separately would require a wider PSBTInput representation change. No current in-tree production producer serializing an explicit zero root was found, so production occurrence is unconfirmed.
Earlier concerns
Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.
- [suggestion]: Reuse the leaf hash when inferring the tree
- [suggestion]: Clarify that each control block reports only its first failure
- [minor]: Check the Merkle root when its field is present
- [suggestion]: Test warning filtering with mixed control blocks
- [suggestion]: Cover skipping invalid candidates when valid records remain