wallet: fill PSBT_GLOBAL_XPUB

bitcoin/bitcoin: PR #36154

Provider refusals

write_verifier: Provider declined the request because of a cybersecurity restriction. Experiments remain incomplete; static verification can continue.

1 major finding · 1 minor finding · 4 suggestions

Earlier concerns neither republished nor resolved: 1 suggestion. See the Run archive for their assessments.

Findings

Link

[major] · Single-key PSBTs disclose the whole account by default

Default bip32derivs=true now exposes standard single-key receive and change chains to PSBT holders, although the established interoperability need is multisig and no single-key signer requiring the field was identified.

Location: src/wallet/scriptpubkeyman.cpp:1502 (head).

Details and suggested fix

For standard wallet-generated descriptors, GetExtPubKeysWithOrigins returns the cached account xpub shared by the receiving and change branches. An unsigned owned input with UTXO data, or merely an owned output in somebody else's PSBT, enables AddGlobalXpubs. The origin, depth and derivation checks accept these ordinary account descriptors. Sharing the resulting PSBT therefore lets its holder enumerate other addresses on both branches, rather than just learn the transaction's per-key fingerprints and paths as before. joinpsbts also preserves these records when participants assemble a transaction.

The release note acknowledges address derivability, but bip32derivs=false also suppresses the per-key paths signers use. Give xpub publication a separate control that defaults off for single-key descriptors while retaining per-key derivations and multisig support. A demonstrated single-key signer requirement would warrant revisiting that default.


Link

[minor] · send, sendall, fee-bump and GUI PSBT exports lack an xpub opt-out

Unlike walletcreatefundedpsbt and walletprocesspsbt, these export paths provide no control to suppress eligible account xpubs, extending their pre-existing mandatory derivation metadata to account-wide address disclosure.

Location: doc/release-notes-36154.md:9 (head).

Details and suggested fix

FinishTransaction, used by send and sendall, first fills with bip32_derivs=true. Its later signing pass with the flag false leaves those records intact. The PSBT is returned for psbt=true, an incomplete transaction, or add_to_wallet=false. psbtbumpfee and the GUI unsigned-send and fee-bump exports likewise populate with the flag true. The PSBT operations dialog also fills on opening, so copying or saving a counterparty's PSBT that pays the wallet can export its account xpub without signing anything.

Expose an xpub-publication control on these RPC and GUI exports. Passing their results through walletprocesspsbt with bip32derivs=false is not a substitute because that operation preserves existing records.


Optional improvements

Link

[suggestion] · External-signer walletprocesspsbt skips the new xpub population

Because the pre-existing external-signer dispatch skips metadata filling, default walletprocesspsbt does not add the new xpubs before signing; callers must first process with sign=false.

Location: src/wallet/scriptpubkeyman.cpp:1503 (head).

Details and suggested fix

For an incomplete incoming PSBT with matching input derivation paths but no global xpubs, walletprocesspsbt makes one FillPSBT call with sign=true. ExternalSignerScriptPubKeyMan then dispatches directly to the signer instead of running the descriptor implementation containing AddGlobalXpubs. External-signer wallets load their descriptors through this override, including imported multisig descriptors. The explicit unsigned pre-pass used by FinishTransaction avoids the omission.

Document the required sign=false pre-pass as a limitation of this feature and add a test starting with paths but no global xpubs. Whether their absence prevents signing depends on the device and any registered policy; that behavior was not verified.


Link

[suggestion] · Unhardened master imports expose sibling branches

An imported descriptor using an unhardened master publishes the master xpub, exposing branches outside that descriptor; wallet-generated descriptors avoid this form, and no current caller producing it was identified.

Location: src/script/descriptor.cpp:689 (head).

Details and suggested fix

For wpkh(<master xpub>/0/*), expansion caches no last-hardened key, so GetExtPubKeysWithOrigins returns the master with an empty origin path. Its depth is zero, and deriving the listed /0/i key succeeds, so the wallet publishes it. A PSBT holder can then derive m/1/*, m/2/* and other unhardened branches, not just the descriptor's m/0/* branch. This follows BIP 174's recommended ancestor selection rather than violating it. Extend the release note's privacy warning to explain that exported xpubs can also reveal addresses outside the contributing descriptors.


Link

[suggestion] · The bip32derivs tests do not protect the xpub-publication gate

Both new opt-out assertions would still pass without the explicit publication gate because neither attempts to add missing xpubs to a PSBT that already contains eligible derivation paths.

Location: test/functional/wallet_multisig_descriptor_psbt.py:335 (head).

Details and suggested fix

walletcreatefundedpsbt(..., bip32derivs=False) hides origins, so AddGlobalXpubs would find no eligible listed keys even if called. The second check reprocesses a PSBT already containing every co-signer xpub, so keep-first merging would leave it unchanged regardless of the flag. Pass separate copies of with_paths, which has paths but no global xpubs, to the matching multisig wallet's walletprocesspsbt with sign=False. Assert no global xpubs with bip32derivs=False and exactly the co-signer records with it true.


Link

[suggestion] · send and fee-bump PSBT outputs lack xpub assertions

The new tests check walletcreatefundedpsbt and walletprocesspsbt, but do not verify global xpubs on the separately populated send, sendall or psbtbumpfee results.

Location: test/functional/wallet_multisig_descriptor_psbt.py:331 (head).

Details and suggested fix

send and sendall rely on FinishTransaction's unsigned population pass, while psbtbumpfee constructs and fills another PSBT in its result branch. Testing the descriptor implementation through other RPCs does not verify that these call sites request and retain the new metadata. Add expected co-signer global_xpubs assertions for send(..., psbt=True) and a psbtbumpfee result in the multisig fixture. The former covers the population helper shared with sendall.


Coverage details

Earlier concerns

Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.

Background

Ralph's summary of historical context for the behaviour affected by this change. The historical record reviewed here is incomplete.

Documented decisions

Hardware-signing interoperability was an explicit motivation for supplying global xpubs. The 2020 request identified BitBox02's need to register and retrieve multisig accounts. Later reports described Ledger incompatibility and Specter's device-specific workaround for adding xpubs. These are workflow requirements, not evidence that every PSBT must contain the optional field.

The new publication path addresses an established gap between Core's per-key derivation information and the account-level information consumed by external multisig signers. Output metadata matters as well as input metadata because signers must recognize change.

Source 1 · Source 2 · Source 3 · Source 4