mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-19 14:40:45 +02:00
rpc: Use IsValidNumArgs in getblock
This commit is contained in:
parent
2eb8c5d7a2
commit
fa1c3591ad
@ -824,9 +824,7 @@ static CBlock GetBlockChecked(const CBlockIndex* pblockindex)
|
|||||||
|
|
||||||
static UniValue getblock(const JSONRPCRequest& request)
|
static UniValue getblock(const JSONRPCRequest& request)
|
||||||
{
|
{
|
||||||
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
|
const RPCHelpMan help{"getblock",
|
||||||
throw std::runtime_error(
|
|
||||||
RPCHelpMan{"getblock",
|
|
||||||
"\nIf verbosity is 0, returns a string that is serialized, hex-encoded data for block 'hash'.\n"
|
"\nIf verbosity is 0, returns a string that is serialized, hex-encoded data for block 'hash'.\n"
|
||||||
"If verbosity is 1, returns an Object with information about block <hash>.\n"
|
"If verbosity is 1, returns an Object with information about block <hash>.\n"
|
||||||
"If verbosity is 2, returns an Object with information about block <hash> and information about each transaction. \n",
|
"If verbosity is 2, returns an Object with information about block <hash> and information about each transaction. \n",
|
||||||
@ -878,7 +876,11 @@ static UniValue getblock(const JSONRPCRequest& request)
|
|||||||
HelpExampleCli("getblock", "\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\"")
|
HelpExampleCli("getblock", "\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\"")
|
||||||
+ HelpExampleRpc("getblock", "\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\"")
|
+ HelpExampleRpc("getblock", "\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\"")
|
||||||
},
|
},
|
||||||
}.ToString());
|
};
|
||||||
|
|
||||||
|
if (request.fHelp || !help.IsValidNumArgs(request.params.size())) {
|
||||||
|
throw std::runtime_error(help.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user