mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 12:17:38 +00:00
WIP: wallet: Store information about created and imported multipath descriptors #36444
No reviewers
Labels
No labels
Android
Backport
Block storage
Brainstorming
Bug
Build system
CI failed
Consensus
Data corruption
Descriptors
Docs
DrahtBot Guix build requested
Feature
Fuzzing
GUI
Good First Review
IPC
Insufficient Review
Kernel
Linux/Unix
Mempool
Mining
Needs Backport (31.x)
Needs Backport (32.x)
Needs Benchmark
Needs Conceptual Review
Needs backport (30.x)
Needs rebase
Needs release note
Net
P2P
PSBT
Privacy
Private Broadcast
Questions and Help
RPC/REST/ZMQ
Refactoring
Resource usage
Review club
Scripts and tools
Settings
TX fees and policy
Tests
Tracking Issue
UTXO Db and Indexes
Up for grabs
Upstream
Utils/log/libs
Validation
Waiting for author
Wallet
Windows
good first issue
interfaces
macOS
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitcoin/bitcoin!36444
Loading…
Reference in a new issue
No description provided.
Delete branch "wallet-store-multipath"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The wallet does not store any information about multipath descriptors. When a multipath descriptor is imported, it is first expanded, then the expansion descriptors are imported into the wallet.
This PR adds a field to
WalletDescriptorwhich stores the IDs of the ScriptPubKeyMans of the descriptors that are part of the expansion, in the order that they are expanded. This allows us to useReconstructMultipathto produce the multipath descriptor when necessary.This is useful for working with hardware wallets that require policy registration, particularly those that require resending the descriptor that was registered.
listdescriptorsis updated to include amultipath_descriptorfield which contains the multipath descriptor for each individual descriptor if it originally came from a multipath descriptor.Lastly, the automatically generated descriptors are now produced and stored as multipath descriptors, so
listdescriptorswill provide amultipath_descriptorfor everything that the wallet automatically generates.Note that the IDs stored in the wallet are ScriptPubKeyMan IDs, which we cannot compute from a descriptor as we assume to be opaque blobs since #35445.
Alternative to #36133, depends on #36442 and #36443
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
External sites
Reviews
See the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste
<!--meta-tag:bot-skip-->into the comment that the bot should ignore.Conflicts
Reviewers, this pull request conflicts with the following ones:
wallet_importdescriptorsto separaterun_test()contents into specific functions by nebula-21)If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
LLM Linter (✨ experimental)
Possible typos and grammar issues:
src/util/bip32.h:give→given[word-form typo in “for a give multipath position”]Possible places where named args for integral literals may be used (e.g.
func(x, /*named_arg=*/0)in C++, andfunc(x, named_arg=0)in Python):src/script/descriptor.cpp:std::make_unique<ConstPubkeyProvider>(key_exp_index, pubkey, false)src/script/descriptor.cpp:std::make_unique<ConstPubkeyProvider>(key_exp_index, pubkey, true)src/script/descriptor.cpp:std::make_unique<ConstPubkeyProvider>(0, pubkey, false)src/script/descriptor.cpp:std::make_unique<ConstPubkeyProvider>(0, pubkey, true)src/qt/test/wallettests.cpp:WalletDescriptor w_desc(std::move(desc), 0, 0, 1, 1)src/wallet/scriptpubkeyman.cpp:Parse(desc_str, provider, error, false)src/wallet/scriptpubkeyman.cpp:WalletDescriptor w_desc(std::move(desc), creation_time, 0, 0, 0)src/wallet/scriptpubkeyman.cpp:WalletDescriptor w_desc(std::move(desc), 0, 0, chain_counter, 0)src/wallet/test/fuzz/scriptpubkeyman.cpp:Parse(desc_str.value(), keys, error, false)src/wallet/test/psbt_wallet_tests.cpp:WalletDescriptor w_desc(std::move(desc), 0, 0, 10, 0)src/wallet/test/util.cpp:Parse(desc_str, keys, error, false)src/wallet/test/wallet_tests.cpp:WalletDescriptor w_desc{std::move(desc), 0, 0, 0, 0}src/wallet/walletutil.cpp:WalletDescriptor w_desc(std::move(desc), creation_time, 0, 0, 0)2026-11-07 03:09:03
🚧 At least one of the CI tasks failed.
Task
lint: https://github.com/bitcoin/bitcoin/actions/runs/37382356159/job/112007221776LLM reason (✨ experimental): CI failed the Python lint check:
wallet_importdescriptors.pyhas undefinedextended_key/xpubnames, andwallet_listdescriptors.pyhas an unused import.Hints
Try to run the tests locally, according to the documentation. However, a CI failure may still
happen due to a number of reasons, for example:
Possibly due to a silent merge conflict (the changes in this pull request being
incompatible with the current code in the target branch). If so, make sure to rebase on the latest
commit of the target branch.
A sanitizer issue, which can only be found by compiling with the sanitizer and running the
affected test.
An intermittent issue.
Leave a comment here, if you need help tracking down a confusing failure.
14 additional verified findings in the full report.
🔴 Major · Method extraction silently skips the import test's final sections
The normal functional-test entry point now skips the multipath and older() sections and six existing subtests, including the PR's new multipath_descriptor assertions.
Location:
test/functional/wallet_importdescriptors.py:1085(head).🟠 Minor · Hardened-prefix normalization produces invalid multipath origins
For imports such as wpkh(xprv/<0h;1h>/*), public listdescriptors returns an unparsable multipath_descriptor whose xpub also differs between member rows.
Location:
src/wallet/scriptpubkeyman.cpp:1650(head).🟠 Minor · Multipath accessors violate the manager-lock annotations
The new accessors omit required manager locks, which should trigger Clang thread-safety diagnostics in warnings-as-errors builds.
Location:
src/wallet/scriptpubkeyman.cpp:1634(head).🟠 Minor · Single-branch reimports erase that member's multipath relationship
Updating one branch persists singleton relatives, so its listdescriptors row loses multipath_descriptor while its sibling still reports the original policy.
Location:
src/wallet/imports.cpp:232(head).🟠 Minor · Watch-only export persists groups that its exported members cannot reconstruct
After watch-only export and restore, hardened-prefix multipath groups lose multipath_descriptor or abort listdescriptors in builds that abort on failed Assume checks.
Location:
src/wallet/export.cpp:153(head).🟠 Minor · createwalletdescriptor leaves generated receive/change pairs unlinked
Unlike wallet initialization, createwalletdescriptor stores singleton relatives for both generated branches, so neither row reports multipath_descriptor.
Location:
src/wallet/wallet.cpp:3456(head).Review coverage was incomplete.
Reviewed:
f57989d701d4· Full review report · Previous reportspermalink
🐙 This pull request conflicts with the target branch and needs rebase.
Concept ACK
🐙 This pull request conflicts with the target branch and needs rebase.
🐙 This pull request conflicts with the target branch and needs rebase.
Concept ACK more for relaying the multi-path info for the automatically generated (and imported) descriptors of the wallet.