#35918 descriptor: Expose key expression parsing
https://github.com/bitcoin/bitcoin/pull/35918 · · +302/-86 in 3 files, 3 commits · labels: Needs rebase, Descriptors
Goal
- Allow callers like the GUI multisig wizard to parse and inspect standalone key expressions
- Reject invalid trailing characters when parsing multisig expressions
This PR moves the abstract `PubkeyProvider` interface into `src/script/descriptor.h`, exposes a public `ParsePubkey()` overload to parse standalone key expressions, adds a `GetOriginInfo()` method to inspect key origin metadata, and tightens the `musig()` parser to reject invalid trailing characters.
Problem: Higher-level callers like the GUI multisig setup wizard need a way to parse, validate, and inspect standalone key expressions without constructing a full output descriptor.
Category: Wallet (#27 of 84)
P3 · new feature
- P3 because it unblocks GUI multisig setup flows without affecting core wallet safety
- Enables validating pasted key expressions and inspecting key origins
- Fixes improper acceptance of trailing characters after multisig expressions
P3 because it provides a useful utility to unblock GUI multisig setup flows (#35645) without affecting core wallet consensus or fund safety. The description explicitly frames this as useful for the GUI multisig wizard tracking issue (#35645) to validate pasted key expressions and inspect key origins. It also fixes a minor issue where trailing characters after musig() were improperly accepted.
Membership: Touches descriptor interfaces in src/script/descriptor.h and src/script/descriptor.cpp, which define descriptor parsing for the wallet.
Factors: security/stability 0, bug 1, performance 0, user value 1, leverage 2
Reviewability: Paused: Waiting on author
- Needs rebase due to merge conflicts
The PR has merge conflicts and an open question from uqlidi regarding whether `ParsePubkey` should parameterize the script context instead of hardcoding P2TR has been unanswered for 19 days.
Author status: silent since 2026-08-11
Open concerns:
- uqlidi asked why the public `ParsePubkey` overload hardcodes `ParseScriptContext::P2TR` rather than taking the context as an argument.
Agreement: Positive
- Support on the latest commit without objections (w0xlt)
- Questions whether to parameterize the script context rather than hardcode taproot (uqlidi)
Positive: ACKed by w0xlt, with an open API design question from uqlidi.
w0xlt provided an ACK on the latest commit. uqlidi raised a constructive API design question about supporting script contexts other than P2TR, but did not object to the concept.
- w0xlt: ACK 93600f9f03
- uqlidi: suggested parameterizing ParseScriptContext rather than hardcoding P2TR
Review verdicts (DrahtBot): 1
- ACK: w0xlt
Dependencies
Enables:
Files
185 lines under test/bench/ci.
- src/test/descriptor_tests.cpp +185/-0
- src/script/descriptor.cpp +32/-86
- src/script/descriptor.h +85/-0
Card
PR #35918 exposes the `PubkeyProvider` interface and adds a public `ParsePubkey()` function to allow standalone descriptor key expression parsing, validation, and origin inspection. This utility is needed by UI workflows such as the multisig wizard (#35645) to validate user-pasted key expressions before creating descriptors. It also fixes a minor parsing bug to reject unexpected trailing characters in `musig()` expressions. The PR has an ACK from w0xlt but is currently dirty and waiting on an author response to an API question from uqlidi.