2 major findings · 6 minor findings · 8 suggestions
Earlier concerns neither republished nor resolved: 1 minor finding. See the Run archive for their assessments.
Findings
[major] · Descriptor fuzz targets dereference rejected parses
Ordinary checksum or syntax rejections now crash both descriptor fuzz targets instead of exercising rejection handling.
Location: src/test/fuzz/descriptor_parse.cpp:123 (head).
Details and suggested fix
Parse now returns nullptr on failure, but both targets immediately call desc->GetMultipathExpansion(). Previously, iterating the empty failure vector was safe. In descriptor_parse, the first iteration requires a checksum, so even raw(51) reaches the null dereference before the checksum-optional pass. The mocked converter only substitutes keys and can also produce rejected syntax. Guard failed parses with return in the mocked target and continue in the checksum loop. Also assert that reconstruction returned mp before evaluating mp->ToString(), so a reconstruction failure produces an explicit invariant failure rather than another null dereference.
[major] · Method extraction removes eight test groups from run_test
Normal wallet_importdescriptors runs now skip the multipath assertions, older() warning checks and six previously dispatched subtests.
Location: test/functional/wallet_importdescriptors.py:1085 (head).
Details and suggested fix
The definition of test_import_multipath ends run_test after the encrypted-wallet balance check. The six existing helper calls now belong to the otherwise uncalled test_older, so normal execution reaches neither those calls nor the extracted sections. That tail also calls nonexistent test_multipath_import and recursively calls test_older. Restore the dispatch sequence to run_test, use test_import_multipath's actual name, and remove the recursive call. The extracted helpers also need their key fixtures passed in or generated locally: extended_key and xpub were locals of run_test.
[minor] · Public multipath normalization can emit invalid key origins
For multipath branches at or before a hardened step, public listdescriptors can return an unparseable multipath_descriptor built with only one branch's cached xpub.
Location: src/wallet/scriptpubkeyman.cpp:1650 (head).
Details and suggested fix
Accepted imports such as wpkh(xprv/<0h;1h>/*) and wpkh(xprv/<0;1>/0h/*) reach GetMultipathString(false) with reconstructible branches. ToNormalizedString then moves the prefix through the last hardened step into the key origin, including <0h;1h> or <0;1>. Core rejects that output because origin parsing forbids multipath. The xpub also comes from the calling member's cache, so the receive and change rows can report different xpubs for the same policy. Omit the public multipath_descriptor for these shapes until normalization can preserve a valid multipath representation, and add coverage that reparses the returned field. The individual desc values and the default-wallet shape with multipath after a common hardened prefix remain correct.
[minor] · Singleton reimports erase multipath membership
Reimporting an existing expansion replaces its relatives with a singleton, removing that row's multipath_descriptor across reloads while siblings retain the original group.
Location: src/wallet/imports.cpp:232 (head).
Details and suggested fix
After importing wpkh(xprv/<0;1>/*), reimporting an original branch expression to extend its range can update the existing manager successfully, provided the new range includes its current range. The final loop nevertheless calls SetMultipathRelatives with only that manager's ID and persists it. GetMultipathString then omits the field because the list has only one member, while the sibling retains both IDs. Reloading does not repair this provenance loss; a full multipath reimport can. Preserve existing relatives on singleton updates, and test a branch update followed by listdescriptors before and after reload.
[minor] · Watch-only export persists unreconstructible multipath groups
Exporting branches that normalize across a multipath step records relative IDs that fail reconstruction, omitting multipath_descriptor or aborting builds that enforce Assume.
Location: src/wallet/export.cpp:153 (head).
Details and suggested fix
For wpkh(xprv/<0;1>/0h/*), export recreates the managers from valid individual strings such as wpkh([fp/0/0h]xpubA/*) and wpkh([fp/1/0h]xpubB/*). It then attaches the remapped original group without checking whether those descriptors still reconstruct. On a restored wallet, listdescriptors rejects their unequal origins and reaches Assume(mp): ordinary Release builds omit the field, while Debug and fuzz builds abort. Hardened alternatives such as <0h;1h> have the same problem. The watched scripts remain usable, and branching after a common hardened prefix still works. Validate reconstruction before persisting exported relationships, and handle a reconstruction failure on persisted state with plain nullopt rather than Assume.
[minor] · createwalletdescriptor leaves generated pairs unlinked
Unlike wallet initialization, createwalletdescriptor generates its default receive/change pair without linking the managers, so neither row reports multipath_descriptor.
Location: src/wallet/wallet.cpp:3456 (head).
Details and suggested fix
Both iterations of the RPC's default loop call SetupDescriptorScriptPubKeyMan without mp_external_rel, leaving each manager with a singleton relative list. This is reachable in a blank wallet after addhdkey, with its returned xpub supplied as hdkey. Carry the external manager's ID into internal-branch setup, including when that external descriptor already exists and generation is skipped. Preserve explicit single-branch requests when no counterpart exists, and add listdescriptors assertions to the createwalletdescriptor tests.
[minor] · Multipath accessors violate descriptor-manager lock contracts
Sibling descriptor reads and the unlocked relatives setter violate cs_desc_man annotations, producing Clang thread-safety diagnostics in warnings-as-errors builds.
Location: src/wallet/scriptpubkeyman.cpp:1634 (head).
Details and suggested fix
GetMultipathString holds only its own cs_desc_man, but calls GetWalletDescriptor() on sibling managers whose annotations require their respective mutexes. SetMultipathRelatives likewise mutates guarded m_wallet_descriptor without locking. Add the setter's lock and collect sibling descriptor snapshots under their own locks at the wallet/export layer, without retaining another manager's lock. Simply nesting sibling locks inside this getter would acquire opposite manager-lock orders as export visits different members. Current callers' cs_wallet locking does not satisfy these annotations, although no reachable runtime race is established.
[minor] · getdescriptorinfo changes its documented single-path result
Multipath input now returns the full expression in descriptor, although the help still promises the first expansion.
Location: src/rpc/output_script.cpp:214 (head).
Details and suggested fix
Returning desc->ToString() changes this field from the first expansion to the full <a;b> expression. Clients that forward the documented single-path value can consequently fail, for example when importing it with an explicit internal option. The Parse ownership refactor does not require this semantic change: desc->GetMultipathExpansion().at(0)->ToString() preserves the old result. Keep that first-expansion value here. If the full-expression result is intentional instead, update the help and provide the documented deprecation and release-note treatment, pointing clients to multipath_expansion[0].
Optional improvements
[suggestion] · RPC range evaluation repeatedly clones descriptor expansions
Each range position recreates every branch and discards reusable MuSig aggregate state, adding avoidable work to scanning and PSBT descriptor RPCs.
Location: src/rpc/util.cpp:1367 (head).
Details and suggested fix
GetMultipathExpansion() clones the whole descriptor tree for every branch, including the single-path case. Calling it inside the index loop repeats that work 1001 times for the default ranged evaluation. For aggregate-then-derive MuSig descriptors, each fresh provider also lacks m_aggregate_provider, so key aggregation repeats instead of reusing the instance as base did. Compute the expansion vector once before the index loop and iterate it with a distinct branch-variable name. This preserves index-major output order, shared provider updates and optional private expansion.
[suggestion] · Expanded-string private round trip checks an earlier object
CheckMultipath serializes and compares the previous reconstruction, leaving the independently reparsed reconstruction's private output unchecked.
Location: src/test/descriptor_tests.cpp:624 (head).
Details and suggested fix
After constructing and publicly checking exp_recon_pub, the test calls recon_pub->ToPrivateString and compares recon_pub_privs, which it already checked earlier. A failure confined to the new object's private serialization would therefore escape these assertions. Call exp_recon_pub->ToPrivateString(prov, exp_recon_pub_privs) and compare exp_recon_pub_privs. Also use mp_prv.at(0) when constructing recon_prv, so that section starts from the parse it intends to exercise.
[suggestion] · Standalone lifetime check now keeps the multipath parent
The intended survivor check no longer destroys the parent and sibling expansions before exercising one expanded descriptor.
Location: src/test/descriptor_tests.cpp:564 (head).
Details and suggested fix
The lambda now returns parsed itself, so the subsequent ToString and Expand calls operate on the multipath parent rather than a surviving expansion. DoCheck does destroy temporary expansion siblings, but retains its parsed parents, so it does not cover parent-lifetime independence. Inside this lambda, obtain GetMultipathExpansion(), move out one branch, and let both the parent and the other branches go out of scope before exercising the survivor. That restores the stated standalone check for the new Clone/ChooseMultipath implementation.
[suggestion] · listdescriptors assertions ignore per-row policy pairing
The test checks descriptor and multipath_descriptor multisets separately, so swapping multipath values between different policies would leave the new assertions passing.
Location: test/functional/wallet_listdescriptors.py:74 (head).
Details and suggested fix
Removing item['desc'] and item['multipath_descriptor'] from independent expected lists proves that both sets of strings appear, but not that each policy belongs to its row. For example, swapping the pkh and tr multipath values preserves these assertions. Build an expected mapping from each single-path descriptor to its multipath descriptor using the existing fixture, then compare each row's field with that mapping. Apply the same check to public and private results; it needs no additional RPC calls.
[suggestion] · SPKM fuzz setup stores unexpanded multipath parents
CreateWalletDescriptor can now construct manager states that wallet imports never create and WalletDescriptor::FromStream refuses to load.
Location: src/wallet/test/fuzz/scriptpubkeyman.cpp:80 (head).
Details and suggested fix
For multipath input, Parse now returns the parent descriptor rather than expanded branches. The successful Expand(0, ...) check merely derives alternative zero; it does not replace that parent. The helper then wraps the same object in WalletDescriptor and passes it into manager creation. Production imports expand before doing this, and database loading explicitly rejects multipath descriptors. Select a branch from GetMultipathExpansion() before the Expand check and before wrapping it, restoring the fixture's previous per-branch semantics.
[suggestion] · Multipath provenance storage grows quadratically with branches
Every member persists the entire ordered group, so N branches add 32N² bytes of relative-ID payload without a branch-count limit.
Location: src/wallet/walletutil.h:98 (head).
Details and suggested fix
ImportDescriptor copies all N manager IDs into every member, and Serialize writes every copy. At 10,000 branches, that is 3.2 GB of ID payload alone, processed under cs_wallet and retained for subsequent loads. This is an arithmetic storage cost, not a measured successful import; the practical ceiling and transient expansion costs remain unmeasured. The usual two-branch case is negligible, and triggering a large import requires an authenticated caller supplying the descriptor. Avoid unbounded per-member copies by storing the ordered group once under an opaque group ID referenced by its members. A justified branch cap is another option if limiting supported group size is acceptable.
[suggestion] · ParseHDKeypath accepts separator-only paths after the rewrite
The string overload now accepts "/" and "m//" as empty paths, unlike base, while current production callers still reject empty paths.
Location: src/util/bip32.cpp:86 (head).
Details and suggested fix
For /, trimming the trailing separator leaves an empty span. For m//, stripping m/ and then the trailing separator does the same. Both now return KeyPath{}, whereas base rejected their empty elements. For the valid empty form m/, the trailing-strip calculation also subtracts from an already empty span; the wrapped count happens to equal std::dynamic_extent. Recognize the permitted empty forms explicitly, reject the formerly invalid separator-only forms, and trim only when the remaining span is nonempty. Add rejection tests for / and m//.
[suggestion] · BIP32 parser retains an unused stream include
The span-based parser no longer needs <sstream>, which remains in a source directory checked by enforced IWYU.
Location: src/util/bip32.cpp:15 (head).
Details and suggested fix
Replacing std::stringstream and std::getline with spans and util::Split removed the last stream use in bip32.cpp. Remove the leftover #include <sstream> so the parser rewrite does not retain this unused dependency in an IWYU-enforced source file.
Earlier concerns
Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.
- [minor]: A failed later expansion can leave earlier descriptors unassociated