Merge 30bf70c8b6 into merged_master (Bitcoin PR bitcoin/bitcoin#27325)

This commit is contained in:
Byron Hambly 2025-05-15 14:47:19 +02:00
commit fd2ba5575f

View file

@ -514,20 +514,15 @@ class PSBTTest(BitcoinTestFramework):
self.nodes[0].decodepsbt(new_psbt)
# Make sure that a non-psbt with signatures cannot be converted
# Error could be either "TX decode failed" (segwit inputs causes parsing to fail) or "Inputs must not have scriptSigs and scriptWitnesses"
# We must set iswitness=True because the serialized transaction has inputs and is therefore a witness transaction
signedtx = self.nodes[0].signrawtransactionwithwallet(rawtx['hex'])
# Can be either a scriptSig or a scriptWitness that it yells about, depending on which UTXOs are selected for the TX
assert_raises_rpc_error(-22, "Inputs must not have", self.nodes[0].converttopsbt, signedtx['hex'], False)
assert_raises_rpc_error(-22, "Inputs must not have", self.nodes[0].converttopsbt, signedtx['hex'])
assert_raises_rpc_error(-22, "", self.nodes[0].converttopsbt, hexstring=signedtx['hex'], iswitness=True)
assert_raises_rpc_error(-22, "", self.nodes[0].converttopsbt, hexstring=signedtx['hex'], permitsigdata=False, iswitness=True)
assert_raises_rpc_error(-22, "Inputs must not have scriptWitnesses",
self.nodes[0].converttopsbt, hexstring=signedtx['hex']) # permitsigdata=False by default
assert_raises_rpc_error(-22, "Inputs must not have scriptWitnesses",
self.nodes[0].converttopsbt, hexstring=signedtx['hex'], permitsigdata=False)
assert_raises_rpc_error(-22, "Inputs must not have scriptWitnesses",
self.nodes[0].converttopsbt, hexstring=signedtx['hex'], permitsigdata=False, iswitness=True)
# Unless we allow it to convert and strip signatures
self.nodes[0].converttopsbt(signedtx['hex'], True)
# Explicitly allow converting non-empty txs
new_psbt = self.nodes[0].converttopsbt(rawtx['hex'])
self.nodes[0].decodepsbt(new_psbt)
self.nodes[0].converttopsbt(hexstring=signedtx['hex'], permitsigdata=True)
# Create outputs to nodes 1 and 2
# We do a whole song-and-dance here (instead of calling sendtoaddress) to get access to the unblinded transaction data to find our outputs