Skip to content

Commit 88a79cb

Browse files
committed
fix converttopsbt permitsigdata arg, add basic test
1 parent c932730 commit 88a79cb

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/rpc/rawtransaction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1669,7 +1669,7 @@ UniValue converttopsbt(const JSONRPCRequest& request)
16691669

16701670
// Remove all scriptSigs and scriptWitnesses from inputs
16711671
for (CTxIn& input : tx.vin) {
1672-
if ((!input.scriptSig.empty() || !input.scriptWitness.IsNull()) && (request.params[1].isNull() || (!request.params[1].isNull() && request.params[1].get_bool()))) {
1672+
if ((!input.scriptSig.empty() || !input.scriptWitness.IsNull()) && !permitsigdata) {
16731673
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Inputs must not have scriptSigs and scriptWitnesses");
16741674
}
16751675
input.scriptSig.clear();

test/functional/rpc_psbt.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ def run_test(self):
107107
# Make sure that a psbt with signatures cannot be converted
108108
signedtx = self.nodes[0].signrawtransactionwithwallet(rawtx['hex'])
109109
assert_raises_rpc_error(-22, "TX decode failed", self.nodes[0].converttopsbt, signedtx['hex'])
110+
assert_raises_rpc_error(-22, "TX decode failed", self.nodes[0].converttopsbt, signedtx['hex'], False)
111+
# Unless we allow it to convert and strip signatures
112+
self.nodes[0].converttopsbt(signedtx['hex'], True)
110113

111114
# Explicitly allow converting non-empty txs
112115
new_psbt = self.nodes[0].converttopsbt(rawtx['hex'])

0 commit comments

Comments
 (0)