rpc: Named arguments for mining calls

pull/308/head
Wladimir J. van der Laan 8 years ago
parent b8ebc595bb
commit 78b684f2ac

@ -78,12 +78,12 @@ UniValue getnetworkhashps(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() > 2) if (request.fHelp || request.params.size() > 2)
throw runtime_error( throw runtime_error(
"getnetworkhashps ( blocks height )\n" "getnetworkhashps ( nblocks height )\n"
"\nReturns the estimated network hashes per second based on the last n blocks.\n" "\nReturns the estimated network hashes per second based on the last n blocks.\n"
"Pass in [blocks] to override # of blocks, -1 specifies since last difficulty change.\n" "Pass in [blocks] to override # of blocks, -1 specifies since last difficulty change.\n"
"Pass in [height] to estimate the network speed at the time when a certain block was found.\n" "Pass in [height] to estimate the network speed at the time when a certain block was found.\n"
"\nArguments:\n" "\nArguments:\n"
"1. blocks (numeric, optional, default=120) The number of blocks, or -1 for blocks since last difficulty change.\n" "1. nblocks (numeric, optional, default=120) The number of blocks, or -1 for blocks since last difficulty change.\n"
"2. height (numeric, optional, default=-1) To estimate at the time of the given height.\n" "2. height (numeric, optional, default=-1) To estimate at the time of the given height.\n"
"\nResult:\n" "\nResult:\n"
"x (numeric) Hashes per second estimated\n" "x (numeric) Hashes per second estimated\n"
@ -150,10 +150,10 @@ UniValue generate(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
throw runtime_error( throw runtime_error(
"generate numblocks ( maxtries )\n" "generate nblocks ( maxtries )\n"
"\nMine up to numblocks blocks immediately (before the RPC call returns)\n" "\nMine up to nblocks blocks immediately (before the RPC call returns)\n"
"\nArguments:\n" "\nArguments:\n"
"1. numblocks (numeric, required) How many blocks are generated immediately.\n" "1. nblocks (numeric, required) How many blocks are generated immediately.\n"
"2. maxtries (numeric, optional) How many iterations to try (default = 1000000).\n" "2. maxtries (numeric, optional) How many iterations to try (default = 1000000).\n"
"\nResult:\n" "\nResult:\n"
"[ blockhashes ] (array) hashes of blocks generated\n" "[ blockhashes ] (array) hashes of blocks generated\n"
@ -186,10 +186,10 @@ UniValue generatetoaddress(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() < 2 || request.params.size() > 3) if (request.fHelp || request.params.size() < 2 || request.params.size() > 3)
throw runtime_error( throw runtime_error(
"generatetoaddress numblocks address (maxtries)\n" "generatetoaddress nblocks address (maxtries)\n"
"\nMine blocks immediately to a specified address (before the RPC call returns)\n" "\nMine blocks immediately to a specified address (before the RPC call returns)\n"
"\nArguments:\n" "\nArguments:\n"
"1. numblocks (numeric, required) How many blocks are generated immediately.\n" "1. nblocks (numeric, required) How many blocks are generated immediately.\n"
"2. address (string, required) The address to send the newly generated bitcoin to.\n" "2. address (string, required) The address to send the newly generated bitcoin to.\n"
"3. maxtries (numeric, optional) How many iterations to try (default = 1000000).\n" "3. maxtries (numeric, optional) How many iterations to try (default = 1000000).\n"
"\nResult:\n" "\nResult:\n"
@ -329,7 +329,7 @@ UniValue getblocktemplate(const JSONRPCRequest& request)
" https://github.com/bitcoin/bips/blob/master/bip-0145.mediawiki\n" " https://github.com/bitcoin/bips/blob/master/bip-0145.mediawiki\n"
"\nArguments:\n" "\nArguments:\n"
"1. TemplateRequest (json object, optional) A json object in the following spec\n" "1. template_request (json object, optional) A json object in the following spec\n"
" {\n" " {\n"
" \"mode\":\"template\" (string, optional) This must be set to \"template\", \"proposal\" (see BIP 23), or omitted\n" " \"mode\":\"template\" (string, optional) This must be set to \"template\", \"proposal\" (see BIP 23), or omitted\n"
" \"capabilities\":[ (array, optional) A list of strings\n" " \"capabilities\":[ (array, optional) A list of strings\n"
@ -719,7 +719,7 @@ UniValue submitblock(const JSONRPCRequest& request)
"\nArguments:\n" "\nArguments:\n"
"1. \"hexdata\" (string, required) the hex-encoded block data to submit\n" "1. \"hexdata\" (string, required) the hex-encoded block data to submit\n"
"2. \"jsonparametersobject\" (string, optional) object of optional parameters\n" "2. \"parameters\" (string, optional) object of optional parameters\n"
" {\n" " {\n"
" \"workid\" : \"id\" (string, optional) if the server provided a workid, it MUST be included with submissions\n" " \"workid\" : \"id\" (string, optional) if the server provided a workid, it MUST be included with submissions\n"
" }\n" " }\n"
@ -908,19 +908,19 @@ UniValue estimatesmartpriority(const JSONRPCRequest& request)
static const CRPCCommand commands[] = static const CRPCCommand commands[] =
{ // category name actor (function) okSafeMode { // category name actor (function) okSafeMode
// --------------------- ------------------------ ----------------------- ---------- // --------------------- ------------------------ ----------------------- ----------
{ "mining", "getnetworkhashps", &getnetworkhashps, true }, { "mining", "getnetworkhashps", &getnetworkhashps, true, {"nblocks","height"} },
{ "mining", "getmininginfo", &getmininginfo, true }, { "mining", "getmininginfo", &getmininginfo, true, {} },
{ "mining", "prioritisetransaction", &prioritisetransaction, true }, { "mining", "prioritisetransaction", &prioritisetransaction, true, {"txid","priority_delta","fee_delta"} },
{ "mining", "getblocktemplate", &getblocktemplate, true }, { "mining", "getblocktemplate", &getblocktemplate, true, {"template_request"} },
{ "mining", "submitblock", &submitblock, true }, { "mining", "submitblock", &submitblock, true, {"hexdata","parameters"} },
{ "generating", "generate", &generate, true }, { "generating", "generate", &generate, true, {"nblocks","maxtries"} },
{ "generating", "generatetoaddress", &generatetoaddress, true }, { "generating", "generatetoaddress", &generatetoaddress, true, {"nblocks","address","maxtries"} },
{ "util", "estimatefee", &estimatefee, true }, { "util", "estimatefee", &estimatefee, true, {"nblocks"} },
{ "util", "estimatepriority", &estimatepriority, true }, { "util", "estimatepriority", &estimatepriority, true, {"nblocks"} },
{ "util", "estimatesmartfee", &estimatesmartfee, true }, { "util", "estimatesmartfee", &estimatesmartfee, true, {"nblocks"} },
{ "util", "estimatesmartpriority", &estimatesmartpriority, true }, { "util", "estimatesmartpriority", &estimatesmartpriority, true, {"nblocks"} },
}; };
void RegisterMiningRPCCommands(CRPCTable &t) void RegisterMiningRPCCommands(CRPCTable &t)

Loading…
Cancel
Save