mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
Merge pull request #4254 from UdjinM6/fix_permitsigdata
Merge #14356: fix converttopsbt permitsigdata arg, add basic test
This commit is contained in:
commit
47317e8fd0
@ -1701,7 +1701,7 @@ UniValue converttopsbt(const JSONRPCRequest& request)
|
|||||||
|
|
||||||
// Remove all scriptSigs from inputs
|
// Remove all scriptSigs from inputs
|
||||||
for (CTxIn& input : tx.vin) {
|
for (CTxIn& input : tx.vin) {
|
||||||
if ((!input.scriptSig.empty()) && (request.params[1].isNull() || (!request.params[1].isNull() && request.params[1].get_bool()))) {
|
if (!input.scriptSig.empty() && !permitsigdata) {
|
||||||
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Inputs must not have scriptSigs");
|
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Inputs must not have scriptSigs");
|
||||||
}
|
}
|
||||||
input.scriptSig.clear();
|
input.scriptSig.clear();
|
||||||
|
@ -85,6 +85,9 @@ class PSBTTest(BitcoinTestFramework):
|
|||||||
# Make sure that a psbt with signatures cannot be converted
|
# Make sure that a psbt with signatures cannot be converted
|
||||||
signedtx = self.nodes[0].signrawtransactionwithwallet(rawtx['hex'])
|
signedtx = self.nodes[0].signrawtransactionwithwallet(rawtx['hex'])
|
||||||
assert_raises_rpc_error(-22, "Inputs must not have scriptSigs", self.nodes[0].converttopsbt, signedtx['hex'])
|
assert_raises_rpc_error(-22, "Inputs must not have scriptSigs", self.nodes[0].converttopsbt, signedtx['hex'])
|
||||||
|
assert_raises_rpc_error(-22, "Inputs must not have scriptSigs", self.nodes[0].converttopsbt, signedtx['hex'], False)
|
||||||
|
# Unless we allow it to convert and strip signatures
|
||||||
|
self.nodes[0].converttopsbt(signedtx['hex'], True)
|
||||||
|
|
||||||
# Explicilty allow converting non-empty txs
|
# Explicilty allow converting non-empty txs
|
||||||
new_psbt = self.nodes[0].converttopsbt(rawtx['hex'])
|
new_psbt = self.nodes[0].converttopsbt(rawtx['hex'])
|
||||||
|
Loading…
Reference in New Issue
Block a user