diff options
author | MarcoFalke <falke.marco@gmail.com> | 2019-04-09 08:56:13 -0400 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2019-05-01 10:21:21 -0400 |
commit | fad40ec9151248c6e8225e14980424f581d23e02 (patch) | |
tree | f6778f4b5614bfb64f3804959f4f2ec3400d9ea6 /src/wallet | |
parent | 2eb8c5d7a28b4dcecd60484773eaacd1608f6291 (diff) |
wallet: Use IsValidNumArgs in getwalletinfo rpc
Diffstat (limited to 'src/wallet')
-rw-r--r-- | src/wallet/rpcwallet.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 5a22508c4b..336b3c73b3 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -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 |