Skip to content

wallet: fill in the wallet's HD keys when importing a descriptor - #127

Open
Sjors wants to merge 2 commits into
2026/08/multipath-tagfrom
2026/09/parse-known-keys
Open

wallet: fill in the wallet's HD keys when importing a descriptor#127
Sjors wants to merge 2 commits into
2026/08/multipath-tagfrom
2026/09/parse-known-keys

Conversation

@Sjors

@Sjors Sjors commented Sep 2, 2026

Copy link
Copy Markdown
Owner

Proof of concept alternative approach to bitcoin#32861.

Based on bitcoin#36133.

@Sjors Sjors mentioned this pull request Sep 2, 2026
6 tasks
Add an optional Parse() input with extended private keys known to the
caller, by their public form, used to fill in the extended public keys
of the descriptor as if it contained the private keys. ParseState
carries it through the parsers, including Miniscript keys and musig()
participants.

A key expression with an explicit origin that leads from a known key to
its extended public key is replaced by that key and the full derivation
path, matching a descriptor that contains the known key. A known
extended public key without such an origin keeps its expression and
only gains the private key.

Known keys do not change the multipath descriptor output.
When importdescriptors is given a descriptor with extended public keys
of the wallet's HD keys, or keys with an origin from them, fill in the
private keys, so that such descriptors can be imported into wallets with
private keys enabled.
@Sjors
Sjors force-pushed the 2026/09/parse-known-keys branch from 4439504 to 11f7606 Compare September 3, 2026 06:43
Sjors added a commit that referenced this pull request Sep 3, 2026
bitcoin#33112 tests walletdisplayaddress for an imported
external-signer descriptor using the same xpub as a wallet exercised earlier
in wallet_signer.py. bitcoin#36114 then revamps the shared external
signer mock used by the test. With #127, the imported descriptor's
known HD keys are filled immediately, so its first address is recognized as
used and the wallet advances to the next index, which the mock intentionally
maps to wrong_address for a separate error case.

Let the test configure the address echoed by the mock so it remains
independent of the derived index while preserving the mismatched-address
coverage.
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.

1 participant