Skip to content

Conversation

ajtowns
Copy link
Contributor

@ajtowns ajtowns commented Mar 14, 2022

walletprocesspsbt says that the sighashtype argument will only be used "if not specified by the PSBT" and CWallet::FillPSBT in wallet/wallet.h says the same thing. This changes FillPSBT to actually behave that way, and as a result removes the SIGHASH_MISMATCH error code.

@ajtowns
Copy link
Contributor Author

ajtowns commented Mar 16, 2022

fixed typo in commit message

@achow101
Copy link
Member

The original intent is to always use the sighash type given in the RPC rather than the PSBT. If the PSBT provides a sighash type, then it needs to match the sighash given in the argument.

@ajtowns
Copy link
Contributor Author

ajtowns commented Mar 17, 2022

Hmm, the psbt is supposed to "[contain] the information necessary for a signer to produce signatures for the transaction"; seems weird that you'd have to specify the sighash type via rpc, and the value in the psbt is only usable for error checking. (And I think the external signer stuff doesn't receive the rpc arg, so can only use the psbt value?) I also think this approach will make it impossible to sign a psbt that specifies an ALL signature on input 1 and a SINGLE|ANYONECANPAY signature on input 2, if the wallet happens to know both keys?

Anyway, sounds like it's not a no-brainer fix, so will close this and leave to others to worry about.

@ajtowns ajtowns closed this Mar 17, 2022
@bitcoin bitcoin locked and limited conversation to collaborators Mar 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants