Skip to content

Commit 495eb44

Browse files
committed
rpc: Named arguments for blockchain calls
1 parent 6f1c76a commit 495eb44

File tree

1 file changed

+31
-31
lines changed

1 file changed

+31
-31
lines changed

src/rpc/blockchain.cpp

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -232,11 +232,11 @@ UniValue waitforblock(const JSONRPCRequest& request)
232232
{
233233
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
234234
throw runtime_error(
235-
"waitforblock <blockhash> (timeout)\n"
235+
"waitforblock <hash> (timeout)\n"
236236
"\nWaits for a specific new block and returns useful info about it.\n"
237237
"\nReturns the current block on timeout or exit.\n"
238238
"\nArguments:\n"
239-
"1. blockhash to wait for (string)\n"
239+
"1. hash (string) Block hash to wait for.\n"
240240
"2. timeout (int, optional, default=0) Time in milliseconds to wait for a response. 0 indicates no timeout.\n"
241241
"\nResult:\n"
242242
"{ (json object)\n"
@@ -858,12 +858,12 @@ UniValue gettxout(const JSONRPCRequest& request)
858858
{
859859
if (request.fHelp || request.params.size() < 2 || request.params.size() > 3)
860860
throw runtime_error(
861-
"gettxout \"txid\" n ( includemempool )\n"
861+
"gettxout \"txid\" n ( include_mempool )\n"
862862
"\nReturns details about an unspent transaction output.\n"
863863
"\nArguments:\n"
864864
"1. \"txid\" (string, required) The transaction id\n"
865865
"2. n (numeric, required) vout number\n"
866-
"3. includemempool (boolean, optional) Whether to include the mempool\n"
866+
"3. include_mempool (boolean, optional) Whether to include the mempool\n"
867867
"\nResult:\n"
868868
"{\n"
869869
" \"bestblock\" : \"hash\", (string) the block hash\n"
@@ -940,11 +940,11 @@ UniValue verifychain(const JSONRPCRequest& request)
940940
int nCheckDepth = GetArg("-checkblocks", DEFAULT_CHECKBLOCKS);
941941
if (request.fHelp || request.params.size() > 2)
942942
throw runtime_error(
943-
"verifychain ( checklevel numblocks )\n"
943+
"verifychain ( checklevel nblocks )\n"
944944
"\nVerifies blockchain database.\n"
945945
"\nArguments:\n"
946946
"1. checklevel (numeric, optional, 0-4, default=" + strprintf("%d", nCheckLevel) + ") How thorough the block verification is.\n"
947-
"2. numblocks (numeric, optional, default=" + strprintf("%d", nCheckDepth) + ", 0=all) The number of blocks to check.\n"
947+
"2. nblocks (numeric, optional, default=" + strprintf("%d", nCheckDepth) + ", 0=all) The number of blocks to check.\n"
948948
"\nResult:\n"
949949
"true|false (boolean) Verified or not\n"
950950
"\nExamples:\n"
@@ -1367,33 +1367,33 @@ UniValue reconsiderblock(const JSONRPCRequest& request)
13671367
}
13681368

13691369
static const CRPCCommand commands[] =
1370-
{ // category name actor (function) okSafeMode
1371-
// --------------------- ------------------------ ----------------------- ----------
1372-
{ "blockchain", "getblockchaininfo", &getblockchaininfo, true },
1373-
{ "blockchain", "getbestblockhash", &getbestblockhash, true },
1374-
{ "blockchain", "getblockcount", &getblockcount, true },
1375-
{ "blockchain", "getblock", &getblock, true },
1376-
{ "blockchain", "getblockhash", &getblockhash, true },
1377-
{ "blockchain", "getblockheader", &getblockheader, true },
1378-
{ "blockchain", "getchaintips", &getchaintips, true },
1379-
{ "blockchain", "getdifficulty", &getdifficulty, true },
1380-
{ "blockchain", "getmempoolancestors", &getmempoolancestors, true },
1381-
{ "blockchain", "getmempooldescendants", &getmempooldescendants, true },
1382-
{ "blockchain", "getmempoolentry", &getmempoolentry, true },
1383-
{ "blockchain", "getmempoolinfo", &getmempoolinfo, true },
1384-
{ "blockchain", "getrawmempool", &getrawmempool, true },
1385-
{ "blockchain", "gettxout", &gettxout, true },
1386-
{ "blockchain", "gettxoutsetinfo", &gettxoutsetinfo, true },
1387-
{ "blockchain", "verifychain", &verifychain, true },
1388-
1389-
{ "blockchain", "preciousblock", &preciousblock, true },
1370+
{ // category name actor (function) okSafe argNames
1371+
// --------------------- ------------------------ ----------------------- ------ ----------
1372+
{ "blockchain", "getblockchaininfo", &getblockchaininfo, true, {} },
1373+
{ "blockchain", "getbestblockhash", &getbestblockhash, true, {} },
1374+
{ "blockchain", "getblockcount", &getblockcount, true, {} },
1375+
{ "blockchain", "getblock", &getblock, true, {"hash","verbose"} },
1376+
{ "blockchain", "getblockhash", &getblockhash, true, {"index"} },
1377+
{ "blockchain", "getblockheader", &getblockheader, true, {"hash","verbose"} },
1378+
{ "blockchain", "getchaintips", &getchaintips, true, {} },
1379+
{ "blockchain", "getdifficulty", &getdifficulty, true, {} },
1380+
{ "blockchain", "getmempoolancestors", &getmempoolancestors, true, {"txid","verbose"} },
1381+
{ "blockchain", "getmempooldescendants", &getmempooldescendants, true, {"txid","verbose"} },
1382+
{ "blockchain", "getmempoolentry", &getmempoolentry, true, {"txid"} },
1383+
{ "blockchain", "getmempoolinfo", &getmempoolinfo, true, {} },
1384+
{ "blockchain", "getrawmempool", &getrawmempool, true, {"verbose"} },
1385+
{ "blockchain", "gettxout", &gettxout, true, {"txid","n","include_mempool"} },
1386+
{ "blockchain", "gettxoutsetinfo", &gettxoutsetinfo, true, {} },
1387+
{ "blockchain", "verifychain", &verifychain, true, {"checklevel","nblocks"} },
1388+
1389+
{ "blockchain", "preciousblock", &preciousblock, true, {"hash"} },
13901390

13911391
/* Not shown in help */
1392-
{ "hidden", "invalidateblock", &invalidateblock, true },
1393-
{ "hidden", "reconsiderblock", &reconsiderblock, true },
1394-
{ "hidden", "waitfornewblock", &waitfornewblock, true },
1395-
{ "hidden", "waitforblock", &waitforblock, true },
1396-
{ "hidden", "waitforblockheight", &waitforblockheight, true },
1392+
{ "hidden", "invalidateblock", &invalidateblock, true, {"hash"} },
1393+
{ "hidden", "reconsiderblock", &reconsiderblock, true, {"hash"} },
1394+
{ "hidden", "waitfornewblock", &waitfornewblock, true, {"timeout"} },
1395+
{ "hidden", "waitforblock", &waitforblock, true, {"hash","timeout"} },
1396+
{ "hidden", "waitforblockheight", &waitforblockheight, true, {"height","timeout"} },
13971397
};
13981398

13991399
void RegisterBlockchainRPCCommands(CRPCTable &t)

0 commit comments

Comments
 (0)