6 minor findings · 5 suggestions
Findings
[minor] · Derived duplicates in musig() count as distinct participants
Crafted coordinator input can receive recognized: true even when musig() participants derive the same public key; no honest producer of this input was identified.
Location: src/script/descriptor_analyzer.cpp:205 (head).
Details and suggested fix
Let B be the xpub at A/1/2. The descriptor tr(musig(A/1/2,B)/0/*,sortedmulti_a(2,A/0/*,B/0/*)) passes because CheckMuSigParticipants and ClassifyKeyPath compare roots A and B, ignoring the participant derivation. Expansion aggregates B twice, and equal inputs are permitted, so its holder can compute the aggregate private key and spend through the key path. The leaf also misses this grandchild relationship, so this shares the related-key assurance limitation rather than establishing another authorization bypass. Compare publicly evaluated participant keys at index 0 as well as roots, report repetition, and add this case as a regression test.
[minor] · The recognized contract overstates related-key detection
Although recognized does not authenticate holders, its help overstates related-key screening: isolated grandchildren and direct children with rewritten parent fingerprints can pass.
Location: src/rpc/descriptor_util.cpp:27 (head).
Details and suggested fix
CheckRepeatedKeys links slots only through equal root public keys, equal index-0 derived keys, or verified direct-child relationships. For example, wsh(sortedmulti(2,A/5/*,G/*,C/0/*)), where G is the xpub at A/1/2, has none of those links despite one root secret controlling two slots. The existing grandchild test detects the relationship only through a third bridging slot. A direct child with different suffix derivation also escapes if its parent fingerprint is rewritten: deserialization accepts that metadata, derivation ignores it, and IsDirectChild exits before verifying the child. Describe recognition as a supported structural setup with no shared key detected by these bounded checks, list the checked relationships and limitations in the public documentation, and add an isolated-grandchild test to pin down that contract.
[minor] · WATCH_ONLY suppresses unresolved private ownership in locked wallets
After a partial-private import, a locked wallet can report watch_only and can_sign: false for its own hardened account key; no routine in-tree workflow producing this state was identified.
Location: src/wallet/descriptor_analyzer.cpp:41 (head).
Details and suggested fix
Store master M with addhdkey, then import a multisig descriptor containing its hardened account xpub A publicly alongside an unrelated xprv. This import is accepted with a warning and stores no private key for A. After encrypting and locking, analyze only wpkh([fpM/48h/1h/0h/2h]A/0/*). MatchHDKeys obtains UNKNOWN through M and WATCH_ONLY through the exact public account entry, but Best() keeps the latter. Consequently, CanSign() returns false instead of preserving the documented unlock-and-retry signal; unlocking changes the match to mine. Rank MINE > UNKNOWN > WATCH_ONLY > NOT_MINE and add a locked/unlocked test containing both candidate entries.
[minor] · first_address comparison misses mismatched change paths
For a fixed wallet, descriptors differing only in later multipath derivation can produce identical analyzedescriptor results, so comparing first_address misses mismatched change paths.
Location: src/wallet/rpc/wallet.cpp:1102 (head).
Details and suggested fix
Changing one cosigner expression from A/<0;1>/* to A/<0;2>/*, with the other expressions unchanged, preserves the first branch, its key inventory and its first address. Both later branches also pass the setup comparison because it checks roots and setup properties, not derivation suffixes. Participants can therefore compare the reported address successfully but import different change scripts, leaving one wallet unaware of another participant's change until the correct descriptor is imported. getdescriptorinfo already exposes a checksum and all expanded branches. Return a checksum covering the complete canonical public descriptor here too, and document that participants should compare it as well.
[minor] · Imported constant public keys are reported as not_mine
A private-keys-disabled wallet containing only wpkh(P) reports P as not_mine rather than watch_only, although can_sign: false remains correct.
Location: src/wallet/descriptor_analyzer.cpp:121 (head).
Details and suggested fix
MatchConstKey checks stored private keys, then tries descriptor or recorded origins against the wallet's HD keys. A constant provider has no extended root, so this wallet's HD map is empty and even analyzing the exact imported descriptor returns NOT_MINE. This disagrees with the RPC's definition of watch_only and its handling of explicitly imported xpubs. Add a public-key fallback for constant expressions explicitly present in the wallet's descriptors, with an import/analyze round-trip test. Do not apply it to every cached public key: another cosigner's key derived from an xpub must retain the existing NOT_MINE behavior.
[minor] · Depth-exhausted xpubs are still recognized as usable cosigners
Crafted depth-255 xpubs receive recognized: true despite being unable to derive addresses; no current producer of this input was identified.
Location: src/script/descriptor_analyzer.cpp:82 (head).
Details and suggested fix
CheckCosignerKeys validates extended-key type, hardened derivation and wildcard syntax, but not successful derivation. With a depth-255 xpub A, wsh(multi(1,A/*)) passes those checks. CExtPubKey::Derive fails, but FirstDerivedKey converts that into nullopt without recording an issue. The wallet RPC consequently omits first_address while retaining recognition, and importdescriptors subsequently rejects the descriptor at its expansion check. Report public derivation failures as analysis issues on every branch, including the Taproot internal key, and add exhausted-depth coverage.
Optional improvements
[suggestion] · No wallet-level warning when owned slots meet the threshold
Two hardened accounts from one stored master can both be mine in a recognized 2-of-3 setup without a warning, even though the wallet holds enough private keys to meet the threshold.
Location: src/wallet/descriptor_analyzer.cpp:159 (head).
Details and suggested fix
For account keys at m/48h/1h/0h/2h and m/48h/1h/1h/2h, plus an outside key, the wallet-free check sees distinct roots and recognizes the setup. An unlocked wallet holding their master verifies both account origins as MINE, but CanSign() stops at the first match. The per-key results expose this information, yet nothing highlights that one wallet controls the threshold. Expose the owned cosigner slot IDs or count and add a separate wallet-level warning when that count reaches the threshold. Count only MINE, not WATCH_ONLY or UNKNOWN, and keep this separate from the wallet-free recognition result.
[suggestion] · Shared-origin cosigner slots have no advisory warning
Equal origin fingerprints can expose an accidental same-seed cosigner entry, but analysis gives no advisory warning; these unauthenticated annotations do not prove common control.
Location: src/script/descriptor_analyzer.cpp:122 (head).
Details and suggested fix
CheckRepeatedKeys ignores origins. The functional test already recognizes the pair at m/48h/1h/0h and m/48h/1h/0h/2h, both generated from the same master and carrying its fingerprint. Accidentally adding two hardened accounts from one participant has the same limitation. Consider a separate, non-blocking same-fingerprint warning for preflight display. Fingerprints can collide and origins can be forged or removed, so do not classify this as proven repeated_key or clear recognized on that basis.
[suggestion] · Multipath analysis discards later-branch diagnostics
A failure confined to a later multipath branch loses its specific issue and key IDs, leaving callers with only branches_differ despite a correctly unrecognized verdict.
Location: src/script/descriptor_analyzer.cpp:298 (head).
Details and suggested fix
For wsh(sortedmulti(2,A/<0;1>/*,B/<0;1h>/*,C/<0;1>/*)), the change branch identifies hardened_derivation on key 1, but the returned result contains only branches_differ with no keys. The overload compares setup fields and never retains other.issues. If both branches are unrecognized, Unrecognize() has reset every compared field, so additional later-branch failures disappear without even adding branches_differ. Retain the specific issues and corresponding occurrence IDs from later branches, with enough branch context to interpret them, and extend the test to assert the failing key.
[suggestion] · analyzedescriptor omits the shared format's experimental warning
analyzedescriptor exposes the same keys and analysis formats marked experimental by getdescriptorinfo, without warning its callers that those formats may change.
Location: src/wallet/rpc/wallet.cpp:1082 (head).
Details and suggested fix
getdescriptorinfo explicitly warns that its verbose fields may change in future releases. analyzedescriptor builds its keys and analysis objects through the same shared helpers, but neither its help nor the release note conveys that stability qualification. Add the same experimental warning to this RPC and the release note so tooling authors receive a consistent contract regardless of which endpoint they use.
[suggestion] · combo() never receives a first_address
FirstAddress stops at the P2PK output that combo() always emits first, omitting the field even when later outputs have derivable addresses.
Location: src/wallet/descriptor_analyzer.cpp:148 (head).
Details and suggested fix
Even combo(P) with a valid constant key expands to P2PK followed by an addressable P2PKH output. ExtractDestination returns false for P2PK, so FirstAddress() returns nullopt without examining the remaining scripts. This also affects the combo() descriptors produced by wallet migration. Since analyzedescriptor accepts any descriptor and describes the field as absent when it cannot be derived, return the first addressable output, following the existing deriveaddresses convention, and add a combo() case.
Background
Ralph's summary of historical context for the behaviour affected by this change. The historical record reviewed here is incomplete.
Documented decisions
The historical holder model does not authenticate independent people or devices. BenWestgate explicitly noted that a user cannot tell whether every other key is controlled by one party. The tracking issue separately requested own-slot identification, threshold and key details, and a first address as preflight information.
A recognized result must be understood at the key-control level, with participant identity and agreement checked separately. Detecting demonstrably related key slots can prevent a misleading holder count, but distinct-looking xpubs cannot establish distinct real-world owners. The wallet's own-key result and participants' comparison of setup information remain separate parts of the workflow.