Skip to content

Commit 47ed24c

Browse files
committed
Merge #14356: fix converttopsbt permitsigdata arg, add basic test
88a79cb fix converttopsbt permitsigdata arg, add basic test (Gregory Sanders) Pull request description: The final check for extraneous sigdata has a flipped boolean, resulting in incorrect behavior. Resolves bitcoin/bitcoin#14355 Tree-SHA512: 5157a74b8ddebd7d836fba96765c4d7ed15a73d4289817353d3566a0f6803bd4bbc3f936735c517c7a83a6cbdb4052b9c61d23f6cc4ad00a6077278cd51adbd4
2 parents 90c0b6a + 88a79cb commit 47ed24c

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
@@ -1672,7 +1672,7 @@ UniValue converttopsbt(const JSONRPCRequest& request)
16721672

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

test/functional/rpc_psbt.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ def run_test(self):
146146
# Make sure that a psbt with signatures cannot be converted
147147
signedtx = self.nodes[0].signrawtransactionwithwallet(rawtx['hex'])
148148
assert_raises_rpc_error(-22, "TX decode failed", self.nodes[0].converttopsbt, signedtx['hex'])
149+
assert_raises_rpc_error(-22, "TX decode failed", self.nodes[0].converttopsbt, signedtx['hex'], False)
150+
# Unless we allow it to convert and strip signatures
151+
self.nodes[0].converttopsbt(signedtx['hex'], True)
149152

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

0 commit comments

Comments
 (0)