The current external signer functional test mock can only echo a prepared PSBT. This gets in the way of testing more complicated scenarios, i.e. misbehaving signers and (MuSig2) multisig.
- test: have external signer mock use a wallet: gives the mock its own offline node and wallet with private keys, while the test uses the watch-only version.
- external_signer: require matching PSBT versions
- external_signer: merge PSBT response instead of replacing: tests signers that drop outputs, reduce their value or change the script. Merging rejects these changes while allowing signers to omit unnecessary PSBT fields.
- external_signer: reject unsafe sighash types
- external_signer: reject finalized PSBT inputs: keeps the above check simple. Documents this new requirement. HWI does not finalize.
The remaining commits prepare the test helpers and enforce IWYU for src/external_signer.cpp.
This PR absorbs the scenarios from #35358, but is better able to test them thanks to the new mock signer implementation.
This PR does not intend to fully harden against a malicious external signer, and can't protect against a malicious HWI (equivalent) process running as the same user.