wallet: Use IsValidNumArgs in getwalletinfo rpc

This commit is contained in:
MarcoFalke 2019-04-09 08:56:13 -04:00
parent 2eb8c5d7a2
commit fad40ec915
No known key found for this signature in database
GPG key ID: CE2B75697E69A548

View file

@ -2382,9 +2382,7 @@ static UniValue getwalletinfo(const JSONRPCRequest& request)
return NullUniValue;
}
if (request.fHelp || request.params.size() != 0)
throw std::runtime_error(
RPCHelpMan{"getwalletinfo",
const RPCHelpMan help{"getwalletinfo",
"Returns an object containing various wallet state info.\n",
{},
RPCResult{
@ -2408,7 +2406,11 @@ static UniValue getwalletinfo(const JSONRPCRequest& request)
HelpExampleCli("getwalletinfo", "")
+ HelpExampleRpc("getwalletinfo", "")
},
}.ToString());
};
if (request.fHelp || !help.IsValidNumArgs(request.params.size())) {
throw std::runtime_error(help.ToString());
}
// Make sure the results are valid at least up to the most recent block
// the user could have gotten from another RPC command prior to now