Skip to content

Commit fad40ec

Browse files
author
MarcoFalke
committed
wallet: Use IsValidNumArgs in getwalletinfo rpc
1 parent 2eb8c5d commit fad40ec

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/wallet/rpcwallet.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2382,9 +2382,7 @@ static UniValue getwalletinfo(const JSONRPCRequest& request)
23822382
return NullUniValue;
23832383
}
23842384

2385-
if (request.fHelp || request.params.size() != 0)
2386-
throw std::runtime_error(
2387-
RPCHelpMan{"getwalletinfo",
2385+
const RPCHelpMan help{"getwalletinfo",
23882386
"Returns an object containing various wallet state info.\n",
23892387
{},
23902388
RPCResult{
@@ -2408,7 +2406,11 @@ static UniValue getwalletinfo(const JSONRPCRequest& request)
24082406
HelpExampleCli("getwalletinfo", "")
24092407
+ HelpExampleRpc("getwalletinfo", "")
24102408
},
2411-
}.ToString());
2409+
};
2410+
2411+
if (request.fHelp || !help.IsValidNumArgs(request.params.size())) {
2412+
throw std::runtime_error(help.ToString());
2413+
}
24122414

24132415
// Make sure the results are valid at least up to the most recent block
24142416
// the user could have gotten from another RPC command prior to now

0 commit comments

Comments
 (0)