2 minor findings · 3 suggestions
Findings
[minor] · Conflicting xpub origins make walletprocesspsbt return an undecodable PSBT
With derivations enabled, an eligible xpub already recorded under another origin can be added again, making the returned PSBT fail duplicate-global-key checks.
Location: src/wallet/scriptpubkeyman.cpp:1544 (head).
Details and suggested fix
m_xpubs is keyed by origin, so this insertion deduplicates only within one origin. An incoming PSBT can contain the wallet's current-network xpub under a different fingerprint while retaining canonical input derivation paths. Changing only that fingerprint leaves one global key, so the incoming file still decodes. With the default bip32derivs=true, processing an unsigned owned input with sign=false admits the wallet's origin and inserts the xpub again. An owned change output can also supply the required canonical path. Serialization uses the xpub itself as the global key, so walletprocesspsbt returns without error but subsequent decoding or PSBT processing rejects its result. Enforce uniqueness across all origins, as MergeGlobalXPubs already does, and add a round-trip regression test. Processing the original with bip32derivs=false avoids the extra insertion. No current producer of conflicting origins for the same xpub was found, so occurrence in existing workflows is unconfirmed.
[minor] · Forged PSBT paths bypass the fallback-root exclusion
A supplied derivation record can make a contributing hardened-wildcard descriptor publish its fallback root xpub despite the hardened-derivation exclusion.
Location: src/wallet/scriptpubkeyman.cpp:1520 (head).
Details and suggested fix
For wpkh(master_xprv/0h/0h/*h), expansion caches individual children, not a last-hardened xpub, so the accessor offers the depth-zero master with an empty origin path. Supply a PSBT containing an output owned by that descriptor and an extra derivation entry associating an unrelated valid pubkey with the master's fingerprint and an empty path. The parser accepts that entry, and output updating preserves it. DerivesKeyInPSBT checks only the claimed origin, so the empty suffix passes, as does the depth check. walletprocesspsbt can therefore export the root with sign=false and the default bip32derivs=true. A correctly originated account fallback also passes when its origin length equals its depth. The exported root cannot derive that descriptor's hardened addresses, and no spending authority is exposed. Establish eligibility from the descriptor's own expanded origins rather than caller-supplied claims, and add a hardened-wildcard regression case with an injected root-origin record.
Optional improvements
[suggestion] · Account-xpub disclosure lacks an opt-out on several PSBT paths
Default single-key wallets add account xpubs even during receive-only PSBT processing, while several preparation paths provide no option to suppress this metadata.
Location: src/wallet/scriptpubkeyman.cpp:1502 (head).
Details and suggested fix
An owned output alone enables publication, including when an otherwise foreign PSBT only pays this wallet. GUI loading also fills the object that Copy or Save exports. Default single-key receive (/0/*) and change (/1/*) descriptors share an account key, so sharing such a PSBT reveals that address type's past and future receive/change addresses, rather than just the transaction's pubkeys and paths. send and sendall when returning a PSBT, psbtbumpfee, and GUI preparation force derivations on without exposing the documented opt-out. The demonstrated hardware-signer benefit is multisig; a need for single-key account exports remains unestablished. Add a separate global-xpub control honored by these callers, so multisig signers can receive the field without making account disclosure inseparable from per-key derivations. Also document the receive-only trigger and interfaces without an opt-out.
[suggestion] · The opt-out test misses PSBTs that already contain derivation paths
The new bip32derivs=False assertion would still pass without the explicit global-xpub option guard because its fresh PSBT contains no derivation paths.
Location: test/functional/wallet_multisig_descriptor_psbt.py:217 (head).
Details and suggested fix
Fresh creation hides origins independently of global-xpub export, so DerivesKeyInPSBT rejects every candidate even if the options.bip32_derivs guard is removed. The later with_paths fixture has derivation paths but goes only through signers[1] with the default true option. That wallet owns neither the multisig policy nor the payment output, so this exercises the contribution guard instead. Reuse independent copies of with_paths in participants["multisigs"][0].walletprocesspsbt(..., sign=False) calls. With bip32derivs=False, assert that globals remain empty; with true, assert the exact co-signer records. This covers the updater's opt-out and its addition of globals to an existing path-bearing PSBT.
[suggestion] · The release note's opt-out wording can imply PSBT redaction
Reprocessing a PSBT with bip32derivs=false preserves existing global xpubs, so “leaves the field out” can mislead users sharing an already-populated file.
Location: doc/release-notes-36154.md:9 (head).
Details and suggested fix
walletprocesspsbt decodes the supplied PSBT and serializes the updated object. Disabling derivations skips AddGlobalXpubs; it does not clear m_xpubs. Creating a PSBT with defaults and then reprocessing it with sign=false, bip32derivs=false therefore still returns its account xpubs. Say that false prevents the wallet from adding extended public keys and derivation paths, rather than redacting existing records. Advise setting bip32derivs=false at creation as well as during updates to avoid the wallet adding them.