Skip to content

Commit eaa0419

Browse files
theStackjonatack
authored andcommitted
contrib: fix signet miner (sighash mismatch)
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, hence this leads to a sighash mismatch when the `walletprocesspsbt` RPC is called. Fix this by explicitly passing the correct sighash type. Note that the same change was needed in one of our functional tests, see commit d399266. Reported by gruve-p. Github-Pull: bitcoin#24553 Rebased-From: 12cc020
1 parent 235b042 commit eaa0419

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

contrib/signet/miner

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import base64
88
import json
99
import logging
1010
import math
11-
import os.path
11+
import os
1212
import re
1313
import struct
1414
import sys
@@ -493,10 +493,11 @@ def do_generate(args):
493493
logging.debug("Mining block delta=%s start=%s mine=%s", seconds_to_hms(mine_time-bestheader["time"]), mine_time, is_mine)
494494
mined_blocks += 1
495495
psbt = generate_psbt(tmpl, reward_spk, blocktime=mine_time)
496-
psbt_signed = json.loads(args.bcli("-stdin", "walletprocesspsbt", input=psbt.encode('utf8')))
496+
input_stream = os.linesep.join([psbt, "true", "ALL"]).encode('utf8')
497+
psbt_signed = json.loads(args.bcli("-stdin", "walletprocesspsbt", input=input_stream))
497498
if not psbt_signed.get("complete",False):
498499
logging.debug("Generated PSBT: %s" % (psbt,))
499-
sys.stderr.write("PSBT signing failed")
500+
sys.stderr.write("PSBT signing failed\n")
500501
return 1
501502
block, signet_solution = do_decode_psbt(psbt_signed["psbt"])
502503
block = finish_block(block, signet_solution, args.grind_cmd)

0 commit comments

Comments
 (0)