@@ -1033,9 +1033,7 @@ UniValue signrawtransaction(const JSONRPCRequest& request)
1033
1033
1034
1034
static UniValue sendrawtransaction (const JSONRPCRequest& request)
1035
1035
{
1036
- if (request.fHelp || request.params .size () < 1 || request.params .size () > 2 )
1037
- throw std::runtime_error (
1038
- RPCHelpMan{" sendrawtransaction" ,
1036
+ const RPCHelpMan help{" sendrawtransaction" ,
1039
1037
" \n Submits raw transaction (serialized, hex-encoded) to local node and network.\n "
1040
1038
" \n Also see createrawtransaction and signrawtransactionwithkey calls.\n " ,
1041
1039
{
@@ -1055,7 +1053,11 @@ static UniValue sendrawtransaction(const JSONRPCRequest& request)
1055
1053
" \n As a JSON-RPC call\n "
1056
1054
+ HelpExampleRpc (" sendrawtransaction" , " \" signedhex\" " )
1057
1055
},
1058
- }.ToString ());
1056
+ };
1057
+
1058
+ if (request.fHelp || !help.IsValidNumArgs (request.params .size ())) {
1059
+ throw std::runtime_error (help.ToString ());
1060
+ }
1059
1061
1060
1062
RPCTypeCheck (request.params , {
1061
1063
UniValue::VSTR,
@@ -1095,9 +1097,7 @@ static UniValue sendrawtransaction(const JSONRPCRequest& request)
1095
1097
1096
1098
static UniValue testmempoolaccept (const JSONRPCRequest& request)
1097
1099
{
1098
- if (request.fHelp || request.params .size () < 1 || request.params .size () > 2 ) {
1099
- throw std::runtime_error (
1100
- RPCHelpMan{" testmempoolaccept" ,
1100
+ const RPCHelpMan help{" testmempoolaccept" ,
1101
1101
" \n Returns result of mempool acceptance tests indicating if raw transaction (serialized, hex-encoded) would be accepted by mempool.\n "
1102
1102
" \n This checks if the transaction violates the consensus or policy rules.\n "
1103
1103
" \n See sendrawtransaction call.\n " ,
@@ -1130,7 +1130,10 @@ static UniValue testmempoolaccept(const JSONRPCRequest& request)
1130
1130
" \n As a JSON-RPC call\n "
1131
1131
+ HelpExampleRpc (" testmempoolaccept" , " [\" signedhex\" ]" )
1132
1132
},
1133
- }.ToString ());
1133
+ };
1134
+
1135
+ if (request.fHelp || !help.IsValidNumArgs (request.params .size ())) {
1136
+ throw std::runtime_error (help.ToString ());
1134
1137
}
1135
1138
1136
1139
RPCTypeCheck (request.params , {
0 commit comments