@@ -435,8 +435,13 @@ static UniValue decoderawtransaction(const JSONRPCRequest& request)
435
435
" \n Return a JSON object representing the serialized, hex-encoded transaction.\n " ,
436
436
{
437
437
{" hexstring" , RPCArg::Type::STR_HEX, RPCArg::Optional::NO, " The transaction hex string" },
438
- {" iswitness" , RPCArg::Type::BOOL, /* default */ " depends on heuristic tests" , " Whether the transaction hex is a serialized witness transaction\n "
439
- " If iswitness is not present, heuristic tests will be used in decoding" },
438
+ {" iswitness" , RPCArg::Type::BOOL, /* default */ " depends on heuristic tests" , " Whether the transaction hex is a serialized witness transaction.\n "
439
+ " If iswitness is not present, heuristic tests will be used in decoding.\n "
440
+ " If true, only witness deserialization will be tried.\n "
441
+ " If false, only non-witness deserialization will be tried.\n "
442
+ " This boolean should reflect whether the transaction has inputs\n "
443
+ " (e.g. fully valid, or on-chain transactions), if known by the caller."
444
+ },
440
445
},
441
446
RPCResult{
442
447
" {\n "
@@ -1422,12 +1427,15 @@ UniValue converttopsbt(const JSONRPCRequest& request)
1422
1427
" createpsbt and walletcreatefundedpsbt should be used for new applications.\n " ,
1423
1428
{
1424
1429
{" hexstring" , RPCArg::Type::STR_HEX, RPCArg::Optional::NO, " The hex string of a raw transaction" },
1425
- {" permitsigdata" , RPCArg::Type::BOOL, /* default */ " false" , " If true, any signatures in the input will be discarded and conversion. \n "
1430
+ {" permitsigdata" , RPCArg::Type::BOOL, /* default */ " false" , " If true, any signatures in the input will be discarded and conversion\n "
1426
1431
" will continue. If false, RPC will fail if any signatures are present." },
1427
1432
{" iswitness" , RPCArg::Type::BOOL, /* default */ " depends on heuristic tests" , " Whether the transaction hex is a serialized witness transaction.\n "
1428
- " If iswitness is not present, heuristic tests will be used in decoding. If true, only witness deserializaion\n "
1429
- " will be tried. If false, only non-witness deserialization will be tried. Only has an effect if\n "
1430
- " permitsigdata is true." },
1433
+ " If iswitness is not present, heuristic tests will be used in decoding.\n "
1434
+ " If true, only witness deserialization will be tried.\n "
1435
+ " If false, only non-witness deserialization will be tried.\n "
1436
+ " This boolean should reflect whether the transaction has inputs\n "
1437
+ " (e.g. fully valid, or on-chain transactions), if known by the caller."
1438
+ },
1431
1439
},
1432
1440
RPCResult{
1433
1441
" \" psbt\" (string) The resulting raw transaction (base64-encoded string)\n "
@@ -1444,16 +1452,15 @@ UniValue converttopsbt(const JSONRPCRequest& request)
1444
1452
throw std::runtime_error (help.ToString ());
1445
1453
}
1446
1454
1447
-
1448
1455
RPCTypeCheck (request.params , {UniValue::VSTR, UniValue::VBOOL, UniValue::VBOOL}, true );
1449
1456
1450
1457
// parse hex string from parameter
1451
1458
CMutableTransaction tx;
1452
1459
bool permitsigdata = request.params [1 ].isNull () ? false : request.params [1 ].get_bool ();
1453
1460
bool witness_specified = !request.params [2 ].isNull ();
1454
1461
bool iswitness = witness_specified ? request.params [2 ].get_bool () : false ;
1455
- bool try_witness = permitsigdata ? ( witness_specified ? iswitness : true ) : false ;
1456
- bool try_no_witness = permitsigdata ? ( witness_specified ? !iswitness : true ) : true ;
1462
+ const bool try_witness = witness_specified ? iswitness : true ;
1463
+ const bool try_no_witness = witness_specified ? !iswitness : true ;
1457
1464
if (!DecodeHexTx (tx, request.params [0 ].get_str (), try_no_witness, try_witness)) {
1458
1465
throw JSONRPCError (RPC_DESERIALIZATION_ERROR, " TX decode failed" );
1459
1466
}
0 commit comments