Some descriptor error messages quote the string the caller sent, and a descriptor can hold a private key (a WIF, an xprv). The reply then carries the key into places the request may not go: an application's error log, an error reporter, a screenshot shared for help. Even the first characters of a key give away part of it.
This PR stops the quoting.
Parsing (descriptor.cpp, util/bip32.cpp):
| before | after |
|---|---|
Key ' <key>' is invalid due to whitespace |
Key is invalid due to whitespace |
key '<key>' is not valid |
key is not valid |
Pubkey '<hex>' is invalid |
Pubkey is invalid |
Multi threshold '<text>' is not valid |
same for text of 11 characters or fewer, the length of 4294967295h; Multi threshold is not valid for longer text |
Key path value '<text>' specifies multipath in a section where multipath is not allowed |
same rule: Key path value specifies multipath in a section where multipath is not allowed for longer text |
Key path value '<text>' is not a valid uint32 |
same rule: Key path value is not a valid uint32 for longer text |
'<expr>' is not a valid descriptor function |
'<name>(...' is not a valid descriptor function, where <name> is the text up to (; Not a valid descriptor function if there is no ( or the name is longer than 16 characters |
No key is 11 characters or fewer.
Callers:
Cannot derive script without private keys: '...'(rpc/util.cpp) andCould not add descriptor '...': ...(wallet/imports.cpp) now quotedesc->ToString(), the public form with its checksum.Unable to parse descriptor '...': ...(wallet/rpc/spend.cpp) no longer quotes the string: there is no parsed descriptor to print, and the parse error says what is wrong.
Existing assertions on these messages are updated. New tests check that no part of a key is in the parse errors and the caller errors, including a key with a typo in its last character. They also check the exact text of the caller errors.
This is one of several PRs from a large audit of Bitcoin Core that I did with the help of LLM tools. The audit produced its evidence all at once, which is why the PRs arrive together. I understand each change fully and will answer review questions myself.