Review report

core: PR #36154

2 minor findings · 2 suggestions

Earlier concerns neither republished nor resolved: 1 suggestion. See the Run archive for their assessments.

Findings

Link

[minor] · Same xpub under two origins gives an unparseable PSBT

When wallet filling adds an xpub already present under another origin, it serializes duplicate PSBT_GLOBAL_XPUB keys and returns a PSBT that Core cannot reparse.

Location: src/wallet/scriptpubkeyman.cpp:1519 (head).

Details and suggested fix

AddGlobalXpubs deduplicates only within m_xpubs[origin], but the serialized global key contains the xpub alone. With bip32derivs=true and a contributing descriptor that collects at least two entries, an incoming record for the same xpub under a different origin survives alongside the new record. A recognized output suffices to trigger this without signing. For example, co-signers using bare account xpubs and fully annotated versions of those same xpubs can encounter it in walletprocesspsbt. Conflicting annotations collected from multiple wallet descriptors can cause the same problem. Serialization succeeds, but subsequent decoding rejects the duplicate global key. Use the existing MergeGlobalXPubs cross-origin deduplication rule when adding these entries, and add a wallet-processing round-trip test with a conflicting incoming origin. Processing the original PSBT with bip32derivs=false, or aligning annotations, avoids the conflicting addition. No real-world report of mixed annotations was found, so production prevalence is unconfirmed.


Link

[minor] · Incomplete origins produce nonconforming global xpub records

Multi-xpub descriptors with missing or partial origins can publish global records whose path length disagrees with the xpub depth, contrary to BIP 174; downstream rejection has not been verified.

Location: src/script/descriptor.cpp:645 (head).

Details and suggested fix

BIP 174 requires the number of path indexes in a PSBT_GLOBAL_XPUB value to match the extended key's depth. For a bare non-master xpub with no hardened suffix, this accessor preserves its depth but publishes its own fingerprint and an empty path. Hardened derivation adds only the descriptor's prefix through the last hardened step. An explicit origin can supply the missing ancestry, but OriginPubkeyProvider prepends it without checking the final length. AddGlobalXpubs counts and publishes these entries, so a multisig using bare account xpubs now emits nonconforming records by default. Core's decoder tolerates the mismatch, and no rejecting external parser was verified. After composing explicit origins, omit entries whose path length differs from xpub.nDepth, before counting them for publication, and cover absent, partial and complete origins in tests. Per-input derivations can remain unchanged. This loses metadata that consumers following Core's own-fingerprint convention might otherwise use.


Optional improvements

Link

[suggestion] · Several PSBT paths provide no account-xpub opt-out

PSBTs can disclose receive and change chains even for receive-only transactions, while send, sendall, psbtbumpfee and the GUI provide no account-xpub opt-out.

Location: src/wallet/scriptpubkeyman.cpp:1492 (head).

Details and suggested fix

Publishing the root or last-hardened xpub exposes its unhardened subtree, not just the transaction's individual pubkeys and paths. For a usual multisig built from [fp/48h/1h/0h/2h]xpub/<0;1>/*, recipients of the enriched PSBT can derive both receive and change chains. Any recognized output enables publication, so processing another party's PSBT that only pays this wallet also adds the xpubs. The GUI does this on loading, before signing. walletprocesspsbt can disable additions with bip32derivs=false, but FinishTransaction, psbtbumpfee and GUI filling enable derivations unconditionally. Add a separate global-xpub publication option and honor it in these callers, so users can retain per-key derivations without disclosing account xpubs. This preserves the metadata needed by unregistered co-signers and distinct change descriptors when enabled. Co-signers who already hold the descriptor learn nothing new. If default disclosure remains, the release note should explain its address-derivation scope, receive-only trigger and forced-on callers.


Link

[suggestion] · MuSig exclusion rationale overlooks ranged participants

The new comment says derivation applies only to the aggregate key, but ranged participants are derived individually before aggregation, and the accessor test covers only aggregate-then-derive.

Location: src/script/descriptor.cpp:852 (head).

Details and suggested fix

For musig(xpubA/0/*,xpubB/0/*), GetPubKey derives each participant at pos, records its origin, and aggregates the derived keys in the m_ranged_participants branch. The comment's premise holds for musig(...)/path/*, not for this form. Participant xpubs still do not BIP32-derive the aggregate script key, so omitting them may be intentional; this does not establish that they must be published. Narrow the comment to distinguish the two forms and explain that ranged-participant metadata is deliberately omitted. Add a rawtr(musig(XPUB/0/*,XPUB2/0/*)) accessor case to pin that choice alongside the existing aggregate-then-derive case.


Coverage details

Earlier concerns

Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.