mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-01 16:53:52 +02:00
Merge #15899: rpc: Document iswitness flag and fix bug in converttopsbt
fa499b5f02rpc: bugfix: Properly use iswitness in converttopsbt (MarcoFalke)fa5c5cd141rpc: Switch touched RPCs to IsValidNumArgs (MarcoFalke) Pull request description: When a serialized transaction has inputs, there is no risk in only trying to deserialize it with witness allowed. (This is how all transactions from p2p are deserialized.) In fact, it would avoid a common issue where a transaction with inputs can be deserialized in two ways: * Fixes #12989 * Fixes #15872 * Fixes #15701 * Fixes #13738 * ... When a serialized transaction has no inputs, there is no risk in only trying to deserialze it with witness disallowed. (A transaction without inputs can't have corresponding witness data) ACKs for commit fa499b: meshcollider: utACKfa499b5f02ryanofsky: utACKfa499b5f02. Changes since last review: consolidating commits and making iswitness documentation the same across methods. PastaPastaPasta: utACKfa499b5f02Tree-SHA512: a64423a3131f3f0222a40da557c8b590c9ff01b45bcd40796f77a1a64ae74c6680a6be9d01ece95c492dfbcc7e2810409d2c2b336c2894af00bb213972fc85c6
This commit is contained in:
@@ -152,9 +152,10 @@ class PSBTTest(BitcoinTestFramework):
|
||||
|
||||
# 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'])
|
||||
assert_raises_rpc_error(-22, "", self.nodes[0].converttopsbt, signedtx['hex'])
|
||||
assert_raises_rpc_error(-22, "", self.nodes[0].converttopsbt, signedtx['hex'], False)
|
||||
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)
|
||||
# Unless we allow it to convert and strip signatures
|
||||
self.nodes[0].converttopsbt(signedtx['hex'], True)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user