5 suggestions
Optional improvements
[suggestion] · The can_sign help overstates what recognition proves
Calling analysis.recognized a “safe k-of-n” overstates the bounded structural checks, even though the analysis help separately documents their limits.
Location: src/wallet/rpc/wallet.cpp:1105 (head).
Details and suggested fix
The can_sign help and the CanSign() header comment describe recognition as safety. However, the analyzer cannot establish independent control or that every cosigner can sign. For example, CheckCosignerKeys() rejects H only when it is the root, and the unit test explicitly recognizes a separately encoded child xpub of H. Related cosigner roots can also evade the documented relationship checks. Replace “safe k-of-n” in both locations with “recognized k-of-n shape with no detected repeated or unusable keys,” and state that recognition does not prove cosigner independence or signing capability.
[suggestion] · No advisory when this wallet holds enough cosigner slots
A wallet can verify that it owns enough cosigner slots to meet the threshold, but the result exposes this only through individual mine entries, without an aggregate advisory.
Location: src/wallet/descriptor_analyzer.cpp:194 (head).
Details and suggested fix
Consider an unlocked wallet whose master derives two distinct hardened sibling account keys used in a 2-of-3. MatchPath() verifies both as MINE, while CheckRepeatedKeys() cannot link their roots, so the setup remains recognized. CanSign() returns at the first owned key and does not distinguish participation from holding enough slots to spend alone. Return the owned cosigner IDs or their count, and add a wallet-level advisory when that count reaches the threshold. Count only MINE, not UNKNOWN, and leave structural recognition unchanged.
[suggestion] · Shared cosigner origin fingerprints get no advisory
Repeated master fingerprints could flag accidental same-seed cosigner configurations, but the analyzer provides no hint; such metadata can support only a non-blocking warning, not an ownership verdict.
Location: src/script/descriptor_analyzer.cpp:182 (head).
Details and suggested fix
CheckRepeatedKeys() never examines origins. The functional test therefore recognizes a 2-of-3 containing both [fp/48h/1h/0h] and its hardened child [fp/48h/1h/0h/2h], although one seed controls both slots. Add a separate warning for cosigner origins sharing a master fingerprint to help catch accidental exports of multiple accounts from one seed. Origins can be forged or omitted, and fingerprints can collide, so this must not become repeated_key or change recognized. A separate warnings channel is necessary because every current issue unrecognizes the setup.
[suggestion] · External signing is absent from can_sign
The local-private-key definition makes can_sign false for external-signer wallets even when their device can sign, so interface callers need an explicit limitation.
Location: src/wallet/descriptor_analyzer.cpp:198 (head).
Details and suggested fix
External-signer wallets disable local private keys, so exact or publicly derivable matches are at most WATCH_ONLY, and CanSign() returns false. A separate 48h cosigner account also remains not_mine when the wallet holds only the device's single-sig account xpubs, such as an 84h account. Nevertheless, ExternalSignerScriptPubKeyMan::FillPSBT() delegates signing to the device. The RPC help defines local-key availability, but the wallet interface describes general signing capability. Explicitly document that this preflight excludes delegated signing and cannot determine whether the device supports the supplied multisig policy.
[suggestion] · WalletHDKeys() scans every descriptor manager twice
Each analysis repeats a wallet-wide descriptor scan under cs_wallet, although its inventory pass already contains every extended root needed for the root-to-manager map.
Location: src/wallet/descriptor_analyzer.cpp:160 (head).
Details and suggested fix
GetHDPubKeys(All) copies each WalletDescriptor and traverses its public-key providers. The following inventory loop copies each WalletDescriptor again and visits all BIP32 occurrences, but inserts only MuSig participants. Start with an empty map and insert every BIP32Key occurrence's root with its manager in that loop. This preserves ordinary roots, MuSig participant roots, origins and descriptor-local private-key checks without changing gethdkeys. The saving is an extra scan and WalletDescriptor copy per manager; no latency improvement has been measured.
Background
Ralph's summary of historical context for the behaviour affected by this change. The historical record reviewed here is incomplete.
Documented decisions
Multisig setup verification protects against configuration substitution, not merely malformed descriptors. BIP129 identifies altered membership, thresholds and derivation paths as theft or ransom risks, and assigns each signer responsibility for checking its own key and confirming the resulting policy.
The analysis, wallet-key matches and first addresses serve complementary checks. BIP129 requires matching the actual KEY rather than taking a fingerprint shortcut, and displaying M, N, applicable signer positions, path restrictions and the first address. A recognized structure alone therefore does not establish that this is the setup the participants agreed to.
The earlier multisig-setup discussion explicitly distinguished detecting duplicate keys from proving independent control, and settled the specific refusal-versus-warning exchange in favor of a visible warning.
In #35645, fametrano demonstrated that repeated slots can reduce the effective signer threshold. BenWestgate replied that duplication can be intentional and that a participant cannot tell whether all other keys belong to one party; fametrano accepted warning before confirmation. rxbryan further distinguished constructing interoperable setups from Core's ability to sign valid descriptors. This supports reporting an unrecognized setup without refusing to analyze or sign the descriptor, but not claiming that apparently distinct keys prove independent people.
Source 1 · Source 2 · Source 3 · Source 4
Wallet-policy restrictions were designed for safe human verification on constrained, potentially stateless signers interacting with an untrusted host; they are narrower than the general descriptor language. They prohibit repeated public-key entries while permitting reuse of an xpub through disjoint derivation branches.
BIP388's key-reuse rules cannot by themselves establish independent cosigners. Its 2024 MuSig extension explicitly preserves disjoint-branch reuse and describes repeated xpubs across aggregate and fallback paths. The analyzer's stricter interpretation of two threshold slots sharing a root is thus a k-of-n holder-counting decision, not a general descriptor-validity rule.
Taproot intentionally combines alternative key and script spending paths. Its privacy and efficiency benefits rely on cooperative key aggregation, where all aggregate participants cooperate to sign, while scripts provide other authorized spending conditions.
The threshold leaf is not the whole authority model: the internal key must also be examined. BIP388's historical example combines a 5-of-5 aggregate key path with 3-of-3 aggregate leaves and a plain 3-of-5 fallback when interactive signing is unavailable. This establishes precedent for different mechanisms preserving the same underlying authorization policy, rather than requiring every path to use identical key expressions.
Earlier public-descriptor import work sought to avoid exposing private material by resolving keys inside the wallet. Its proposed origin matching required both a matching fingerprint and derivation to the specified xpub; matching from an imported account key was identified separately as future work.
Origins provide candidate lookup and derivation instructions, not ownership authentication. The head's account-origin prefix matching extends the candidate starting points, but the historical security boundary remains verification of the resulting key. BIP129 independently warns that fingerprints are trivial to spoof.
Descriptor wallets historically support partial private-key knowledge, including multisig descriptors containing both owned and foreign keys. The gethdkeys interface was introduced to expose HD keys, private-key availability and the descriptors using them, rather than treating a private-key-enabled wallet as owning every listed key.
The pinned base computes private availability through the ScriptPubKeyMans containing each xpub. This supplies historical context for distinguishing mine from watch_only and for keeping key availability separate from complete threshold satisfaction.
Ralph's inferences
Recognition is necessarily conditional: the descriptor has an understood threshold shape and no detected authority-reducing relationship, assuming the advertised cosigner roots represent independent signing authorities and are usable by their holders.
The head detects equal roots, equal first derived keys and verifiable direct unhardened parent-child relationships. Hardened relationships cannot be publicly derived, while grandchildren or altered metadata can evade these bounded checks. Earlier recognition-versus-warning discussion supports useful structural screening despite that limit, not an unconditional claim that k independent parties are required. The RPC's 'safe k-of-n' language must be understood together with its explicit inability to determine who owns the keys.
A MuSig key path requiring at least k distinct members of the leaf's cosigner set does not authorize an otherwise unauthorized coalition: any such coalition already contains enough cosigners to spend through the k-of-n leaf.
This explains the head's at-least-k rule without requiring an all-n aggregate. It depends on MuSig requiring all its participants and on root identity correctly representing signing authority. Repeated participants cannot increase the independent count, and a coalition with fewer than k leaf cosigners does not satisfy this argument. This is a derivation from prior design premises, not an exact historical endorsement of the new predicate.
Wallet signing capability should reflect the descriptor-local derivation machinery that can actually supply signing keys, rather than every mathematical combination of key material stored anywhere in the wallet.
The pinned base expands private keys using the selected descriptor manager's GetKeys(), and gethdkeys checks managers associated with the xpub. Consequently, an xpub in one descriptor and its bare private scalar in another do not alone establish that the existing signing path derives its children. The head follows that boundary. Its can_sign result means availability of at least one descriptor key, not complete spending authority, successful import, or an immediately executable signature while locked.
UNKNOWN is an epistemic result: a plausible private-key-bearing candidate exists, but a hardened derivation cannot be verified while the wallet is locked. It is neither authenticated ownership nor evidence of nonownership.
The base descriptor documentation requires private keys for hardened derivation. Combined with exact-key verification, this explains why a fingerprint match may justify retrying after unlock but cannot justify mine. Exact or public-derivable matches remain checkable while locked; a candidate lacking private material does not become checkable by unlocking. UNKNOWN outranks a separate watch-only match because private ownership remains unresolved, and can_sign remains absent unless another key is already known to be mine.
Unresolved disagreements
The inspected record does not resolve whether advisory ownership analysis and private-key substitution should use the same extended-key metadata identity rules.
In #35377, polespinasa questioned comparing depth and fingerprint metadata; achow101 preferred specificity to avoid surprising users by attaching private material to a visually different xpub. The current analyzer instead compares public key plus chain code while ignoring serialization metadata. Both positions require actual key verification, but the earlier discussion concerned import-time substitution, not advisory analysis. Its applicability to this RPC remains an interface-semantics question, not a demonstrated defect.