Repository navigation
Conversation
Combine a receive descriptor with its change counterpart back into the multipath descriptor (BIP 389) both were derived from, e.g. combine wpkh(XPUB/0/*) with wpkh(XPUB/1/*) into wpkh(XPUB/<0;1>/*). Each PubkeyProvider merges itself with its counterpart: the providers must be identical apart from at most one derivation path element, whose hardened flag must match and whose change index must be greater than the receive index. This supports index pairs other than <0;1>, multipath elements at any depth and hardened elements. The DescriptorImpl printing machinery walks both descriptors in lockstep via a new StringType::MULTIPATH, requiring identical structure and non-key arguments, including miniscript and taproot script trees. This is groundwork for reconstructing the imported multipath descriptor from the expanded receive and change descriptor pair stored in a wallet.
Importing a multipath descriptor, conventionally with a /<0;1>/* derivation path, expands it into a separate receive (/0/*) and change (/1/*) descriptor, and generated single key wallets consist of such pairs to begin with. Add DeriveMultipathDescriptor to combine a pair of descriptor SPKMs back into the original multipath descriptor, delegating to Descriptor::ToStringMultipath on the normalized public descriptor pair. This is groundwork for external signer support of descriptors that must be registered on the device, such as multisig and MuSig2: the reconstructed multipath descriptor is what gets registered on (and verified by) the device. The unit test roundtrips a multisig, MuSig2 and non-<0;1> multipath descriptor through pairs of SPKMs, and covers the failure modes: pairs from different multipath descriptors and a swapped receive/change pair. Coverage of the various descriptor shapes lives in descriptor_tests.
Add an optional multipath field to each listdescriptors entry that has a receive or change counterpart in the wallet, containing the multipath descriptor the pair was derived from. Both halves of a pair return the same value, always in public form. This makes the original form of an imported multipath descriptor, which is stored expanded into separate receive and change descriptors, visible again, e.g. for comparison against the other participants' wallets or a signing device.
Add an optional parent_multipath field next to parent_desc, containing the multipath descriptor that the address's parent descriptor and its receive or change counterpart were derived from. This lets a caller see the original imported form of the descriptor an address belongs to, e.g. for comparison against the other participants' wallets or a signing device.
Sjors
force-pushed
the
2026/08/multipath-reconstruct
branch
from
August 25, 2026 08:20
adc4c4d to
bfaa3f6
Compare
This was referenced Aug 25, 2026
Owner
Author
|
Closing in favor of bitcoin#36133. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Still a bit too vibe coded to upstream.