Skip to content

descriptor: add unit tests, rejecting multiple pubkeys - #10947

Merged
ecdsa merged 1 commit into
spesmilo:masterfrom
fametrano:btclib-666-error-messages
Sep 9, 2026
Merged

ecdsa merged 1 commit into
spesmilo:masterfrom
fametrano:btclib-666-error-messages

Conversation

@fametrano

Copy link
Copy Markdown
Contributor

Two error messages in electrum/descriptor.py are wrong:

  • the wpkh branch raises "More than one pubkey in pkh descriptor", naming pkh instead of wpkh;
  • the bare-multisig error "Cannot have {} pubkeys in bare multisig: only at most 3 pubkeys" is never formatted, so it prints the literal {} rather than the key count.

Both are corrected, and a regression test covers each.

These mirror the same fix in Bitcoin Core's HWI, which shares this descriptor code: bitcoin-core/HWI#857.

The wpkh() branch reported "pkh descriptor" when rejecting a second
pubkey; it now names wpkh. The bare multisig branch built its
"Cannot have {} pubkeys" message without formatting in the count, so
the placeholder was emitted verbatim; it now substitutes the number of
pubkeys.
@ecdsa

ecdsa commented Sep 9, 2026

Copy link
Copy Markdown
Member

Looks good to me.
The commit message should be about the added unit tests, this is more important than the fixed error messages.

@ecdsa ecdsa changed the title descriptor: fix two incorrect error messages descriptor: add unit tests, rejecting multiple pubkeys Sep 9, 2026
@ecdsa
ecdsa merged commit 8712102 into spesmilo:master Sep 9, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants