Review report

core: PR #35918

4 suggestions

Optional improvements

Link

[suggestion] · Standalone parsing hides the distinction needed to reject x-only keys

A future P2WSH setup flow cannot reject x-only hex keys through the structured interface because parsing accepts them and GetRootPubKey() returns a synthesized compressed key.

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

Details and suggested fix

The overload always uses P2TR rules, so a valid 32-byte x-only hex key succeeds even though it would fail under P2WSH rules. The provider stores it as 02||x: GetSize() returns 33, and GetRootPubKey() looks like an ordinary compressed key. Only inspecting the serialized key reveals the distinction. Passing ToString() into a full wsh(sortedmulti()) parse still rejects it, but a consumer using GetRootPubKey() directly would instead use the even-Y key, which differs from an odd-Y cosigner key. WIF input retains its actual public key internally, so that substitution concerns x-only hex input only. Let callers select P2WSH or P2TR validation while retaining the current default. No in-tree caller of the new overload exists, so the effect on the GUI is unconfirmed.


Link

[suggestion] · HavePrivateKeys() does not detect partly private MuSig expressions

A caller using HavePrivateKeys() to reject private input would accept a mixed xprv/xpub MuSig expression when the other participant's private key is unavailable.

Location: src/script/descriptor.h:142 (head).

Details and suggested fix

For musig(xprv…,xpub…) with distinct participants, parsing puts the xprv key into out.keys, but the MuSig provider's HavePrivateKeys(out) returns false because it requires private data for every participant. This differs from ToPrivateString(), which succeeds when any participant has private data. Clarify the all-participants requirement in the newly exposed method's documentation and recommend parsing into a fresh FlatSigningProvider and checking !out.keys.empty() to detect supplied private material. A mixed-key standalone test would pin that distinction. Keep the existing predicate semantics, which descriptor tests already cover. No caller of the new overload exists yet.


Link

[suggestion] · Parsed MuSig providers do not expose explicit participant origins

GetOriginInfo() returns nullopt for MuSig expressions even when participants have explicit origins, leaving that metadata unavailable through the structured inspection interface.

Location: src/script/descriptor.h:151 (head).

Details and suggested fix

A musig([deadbeef/48h/0h/0h/2h]xpub…,xpub…) expression retains its participant providers privately, and the returned MuSig provider inherits the default GetOriginInfo() implementation. Expanding with GetPubKey() is not equivalent: it reports derived origins with suffix paths appended, supplies implicit origins for keys without one, and can require private keys for hardened derivation. Expose participant providers or their explicit origins if participant-level inspection is intended. Otherwise, document that GetOriginInfo() reports only an origin attached to the returned provider itself, not origins inside musig(). No in-tree caller uses the new overload for this, so whether the GUI needs participant origins is unconfirmed.


Link

[suggestion] · Failed MuSig parsing can leave private keys in out

A later MuSig participant failure returns an empty vector without removing private keys parsed earlier, but the new API documentation does not describe that partial mutation.

Location: src/script/descriptor.h:171 (head).

Details and suggested fix

For musig(<valid compressed WIF>,invalid), parsing inserts the first participant's key into out.keys before rejecting the second participant. The wrapper passes out through directly, so failure does not undo that insertion. A caller reusing the output across pastes could retain rejected key material and misattribute it to a later input when checking !out.keys.empty(). Document that out may be modified on failure and add a failing MuSig case that establishes this contract. The single-key failure tests all reject before inserting a key. This incremental behavior already exists in descriptor parsing; no caller of the new overload exists, so production impact is unconfirmed.


Coverage details