@@ -431,9 +431,7 @@ static UniValue createrawtransaction(const JSONRPCRequest& request)
431
431
432
432
static UniValue decoderawtransaction (const JSONRPCRequest& request)
433
433
{
434
- if (request.fHelp || request.params .size () < 1 || request.params .size () > 2 )
435
- throw std::runtime_error (
436
- RPCHelpMan{" decoderawtransaction" ,
434
+ const RPCHelpMan help{" decoderawtransaction" ,
437
435
" \n Return a JSON object representing the serialized, hex-encoded transaction.\n " ,
438
436
{
439
437
{" hexstring" , RPCArg::Type::STR_HEX, RPCArg::Optional::NO, " The transaction hex string" },
@@ -485,7 +483,11 @@ static UniValue decoderawtransaction(const JSONRPCRequest& request)
485
483
HelpExampleCli (" decoderawtransaction" , " \" hexstring\" " )
486
484
+ HelpExampleRpc (" decoderawtransaction" , " \" hexstring\" " )
487
485
},
488
- }.ToString ());
486
+ };
487
+
488
+ if (request.fHelp || !help.IsValidNumArgs (request.params .size ())) {
489
+ throw std::runtime_error (help.ToString ());
490
+ }
489
491
490
492
RPCTypeCheck (request.params , {UniValue::VSTR, UniValue::VBOOL});
491
493
@@ -1415,9 +1417,7 @@ UniValue createpsbt(const JSONRPCRequest& request)
1415
1417
1416
1418
UniValue converttopsbt (const JSONRPCRequest& request)
1417
1419
{
1418
- if (request.fHelp || request.params .size () < 1 || request.params .size () > 3 )
1419
- throw std::runtime_error (
1420
- RPCHelpMan{" converttopsbt" ,
1420
+ const RPCHelpMan help{" converttopsbt" ,
1421
1421
" \n Converts a network serialized transaction to a PSBT. This should be used only with createrawtransaction and fundrawtransaction\n "
1422
1422
" createpsbt and walletcreatefundedpsbt should be used for new applications.\n " ,
1423
1423
{
@@ -1438,7 +1438,11 @@ UniValue converttopsbt(const JSONRPCRequest& request)
1438
1438
" \n Convert the transaction to a PSBT\n "
1439
1439
+ HelpExampleCli (" converttopsbt" , " \" rawtransaction\" " )
1440
1440
},
1441
- }.ToString ());
1441
+ };
1442
+
1443
+ if (request.fHelp || !help.IsValidNumArgs (request.params .size ())) {
1444
+ throw std::runtime_error (help.ToString ());
1445
+ }
1442
1446
1443
1447
1444
1448
RPCTypeCheck (request.params , {UniValue::VSTR, UniValue::VBOOL, UniValue::VBOOL}, true );
0 commit comments