Closes #27583.
PSBT_GLOBAL_XPUB already serializes, deserializes and merges when PSBTs are combined. Nothing writes it, so a PSBT produced by the wallet never carries it, and a signer that only has the file cannot rebuild the multisig from it.
A signer with no registered policy to work from needs it: HWI's BitBox02 driver builds the multisig out of the PSBT's extended keys and refuses to sign without them. Today Specter fills the field itself after getting the PSBT from Core, and only when the wallet has more than one key.
<details><summary>Before and after with the BitBox02 and Trezor simulators</summary>
A 2-of-3 wsh(sortedmulti(...)) on regtest with the simulator as one co-signer, signed through HWI 3.2.0. The "before" file is the same PSBT with its PSBT_GLOBAL_XPUB records removed, so nothing else differs.
| without the field | with the field | |
|---|---|---|
| BitBox02 | refuses, This BitBox02 is not one of the cosigners |
signs |
| Trezor T | signs, co-signer nodes sent with zeroed chain codes and no derivation paths | signs, nodes sent with the real chain codes and paths |
What parse_multisig hands the Trezor for the change output:
without: global xpubs=0 zeroed chain codes=3/3 depths=[0, 0, 0] paths=[[], [], []]
with : global xpubs=3 zeroed chain codes=0/3 depths=[4, 4, 4] paths=[[1, 0], [1, 0], [1, 0]]
</details>
Descriptor gains an accessor for its extended keys, each with the origin taken at the deepest hardened step, and DescriptorScriptPubKeyMan::FillPSBT writes them when the descriptor contributed to the PSBT. That covers walletcreatefundedpsbt, walletprocesspsbt, send, sendall, psbtbumpfee and the GUI send dialog, which all go through CWallet::FillPSBT.
The field is only written for descriptors with two or more extended keys. With one, the signer derives its own key from its seed, so the entry would add nothing and only cost space. The field is not small. On a 2-of-3 it adds 291 bytes, taking the PSBT from 933 to 1224. bip32derivs is respected. That same PSBT already carries the full witness_script and bip32_derivs, so what is added is the chain code of each account.
There are unit tests for the accessor, and on the wallet side a functional test with a wallet whose internal descriptor uses different keys from its external one, the only arrangement that can show it publishing on its own.
descriptorprocesspsbt is left out, since it signs from the descriptors it is given without going through the wallet, and I intend to cover it as a follow-up. musig() contributes nothing, since derivation is applied to the aggregate key.
The decodepsbt output changes, and a release note is included.