gruve-p reported that the signet miner doesn’t work anymore (see #24501 (comment)), failing with the following error of the walletprocesspsbt
RPC:
0error code: -22
1error message:
2Specified sighash value does not match value stored in PSBT
3.....
4subprocess.CalledProcessError: Command '['bitcoin-cli', '-signet', '-stdin', 'walletprocesspsbt']' returned non-zero exit status 22
PSBT signing was changed to use SIGHASH_DEFAULT by default in #22514. The signet miner script sets the sighash type of the created PSBT to SIGHASH_ALL (3 is the per-input type PSBT_IN_SIGHASH_TYPE, following a little-endian 32 unsigned integer of the sighash type):
hence this leads to a sighash mismatch when the walletprocesspsbt
RPC is called. Fix this by explicitly passing the correct sighash type. The same change was needed in one of our functional tests, see commit d3992669df826899a3de78a77a366dab46028026.
Note that instead of feeding the PSBT via -stdin
it is directly passed as parameter, as I couldn’t figure out a way to pass multiple parameters otherwise (separating by newline also didn’t work).