Skip to content

Commit 879b64b

Browse files
committed
Merge #607: Fix default permitsigdata value not working on converttopsbt command
794c305 Test that default `permitsigdata` is false (Steven Roose) c8525c9 Fix bug in converttopsbt (Steven Roose) Pull request description: We're not really supporting PSBT for Elements yet. The `rpc_psbt.py` integration test is disabled because of this; that's also why we didn't catch this. It's fixed upstream. I added an extra test to catch the error, but it's not actually executed. @instagibbs, up to you to decide if it's worth having this patched right now. I cherry-picked that fix commit literally from the catchup PR I'm working on, so if we don't patch it here, it will get patched while catching up. Tree-SHA512: 2ee9ed733659c028f349b75aba19b80cef13894eacb0d85d0ab4377ee9e07b4aa90888edb402a5c31784f5d0848a0f22a445736995d9a6fca0bbeccf15f75dcb
2 parents fa8765c + 794c305 commit 879b64b

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/rpc/rawtransaction.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1765,13 +1765,13 @@ UniValue converttopsbt(const JSONRPCRequest& request)
17651765

17661766
// Remove all scriptSigs and scriptWitnesses from inputs
17671767
for (CTxIn& input : tx.vin) {
1768-
if ((!input.scriptSig.empty()) && (request.params[1].isNull() || (!request.params[1].isNull() && request.params[1].get_bool()))) {
1768+
if (!input.scriptSig.empty() && !permitsigdata) {
17691769
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Inputs must not have scriptSigs");
17701770
}
17711771
input.scriptSig.clear();
17721772
}
17731773
for (CTxInWitness& witness: tx.witness.vtxinwit) {
1774-
if ((!witness.scriptWitness.IsNull()) && (request.params[1].isNull() || (!request.params[1].isNull() && request.params[1].get_bool()))) {
1774+
if (!witness.scriptWitness.IsNull() && !permitsigdata) {
17751775
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Inputs must not have scriptWitnesses");
17761776
}
17771777
}

test/functional/rpc_psbt.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ def run_test(self):
106106

107107
# Make sure that a psbt with signatures cannot be converted
108108
signedtx = self.nodes[0].signrawtransactionwithwallet(rawtx['hex'])
109+
assert_raises_rpc_error(-22, "Inputs must not have scriptWitnesses", self.nodes[0].converttopsbt, signedtx['hex'], False)
109110
assert_raises_rpc_error(-22, "Inputs must not have scriptWitnesses", self.nodes[0].converttopsbt, signedtx['hex'])
110111

111112
# Explicitly allow converting non-empty txs

0 commit comments

Comments
 (0)