2 suggestions
Optional improvements
[suggestion] · Key positions do not identify the failing taproot leaf
After removing the quoted key, errors from multi-leaf tr() descriptors can match several leaves because key positions are local and no leaf number is reported.
Location: src/script/descriptor.cpp:2335 (head).
Details and suggested fix
Each miniscript leaf constructs a fresh KeyParser, so its reported key positions restart at 1. multi_a() also numbers keys locally, while a plain pk() leaf adds only the pk(): prefix. The tr() loop returns these errors unchanged. For valid keys H and A and a malformed non-hex key BAD, tr(H,{pk(A),pk(BAD)}) therefore reports only pk(): key is not valid, without identifying the second leaf. Previously the quoted key supplied that location, at the cost of exposing key material. Consider prefixing a failed leaf's error with its one-based leaf number, using subscripts.size() after the emplace_back, and adding a later-leaf test. This preserves acceptance and keeps key text out of errors, though it requires updating existing taproot leaf error expectations.
[suggestion] · A colon alone selects the miniscript diagnostic
An uppercase BIP21 URI passed to getdescriptorinfo is reported as an invalid miniscript expression even though it has no miniscript wrapper syntax.
Location: src/script/descriptor.cpp:2839 (head).
Details and suggested fix
When there is no (, expr_text.substr(0, open) contains the whole expression, so any colon selects Not a valid miniscript expression. For example, an uppercase BITCOIN:BC1Q... input passes the descriptor payload character check, but miniscript's wrapper scan stops at the uppercase I. It reaches this fallback at top level or in a taproot leaf, and getdescriptorinfo forwards the message unchanged. Consider selecting the miniscript wording only for a nonempty lowercase-letter wrapper-shaped prefix, otherwise retaining the generic descriptor error. Do not require ( solely for this distinction: malformed wrapped literals such as vv:1 also warrant the miniscript diagnostic. A lowercase bitcoin: prefix remains syntactically wrapper-shaped under this approach. This changes only rejection wording and quotes no input text.