mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 15:09:59 +01:00
Merge #8811: rpc: Add support for JSON-RPC named arguments
4e7e2e1Update RPC argument names (John Newbery)481f289rpc: Named argument support for bitcoin-cli (Wladimir J. van der Laan)9adb4e1rpc: Argument name consistency (Wladimir J. van der Laan)8d713f7rpc: Named arguments for rawtransaction calls (Wladimir J. van der Laan)37a166frpc: Named arguments for wallet calls (Wladimir J. van der Laan)78b684frpc: Named arguments for mining calls (Wladimir J. van der Laan)b8ebc59rpc: Named arguments for net calls (Wladimir J. van der Laan)2ca9dcdtest: Add test for RPC named arguments (Wladimir J. van der Laan)fba1a61rpc: Named arguments for misc calls (Wladimir J. van der Laan)286ec08rpc: Add 'echo' call for testing (Wladimir J. van der Laan)495eb44rpc: Named arguments for blockchain calls (Wladimir J. van der Laan)6f1c76arpc: Support named arguments (Wladimir J. van der Laan)5865d41authproxy: Add support for RPC named arguments (Wladimir J. van der Laan)
This commit is contained in:
@@ -78,13 +78,13 @@ UniValue getnetworkhashps(const JSONRPCRequest& request)
|
||||
{
|
||||
if (request.fHelp || request.params.size() > 2)
|
||||
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"
|
||||
"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"
|
||||
"\nArguments:\n"
|
||||
"1. blocks (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"
|
||||
"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"
|
||||
"\nResult:\n"
|
||||
"x (numeric) Hashes per second estimated\n"
|
||||
"\nExamples:\n"
|
||||
@@ -150,10 +150,10 @@ UniValue generate(const JSONRPCRequest& request)
|
||||
{
|
||||
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
|
||||
throw runtime_error(
|
||||
"generate numblocks ( maxtries )\n"
|
||||
"\nMine up to numblocks blocks immediately (before the RPC call returns)\n"
|
||||
"generate nblocks ( maxtries )\n"
|
||||
"\nMine up to nblocks blocks immediately (before the RPC call returns)\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"
|
||||
"\nResult:\n"
|
||||
"[ blockhashes ] (array) hashes of blocks generated\n"
|
||||
@@ -186,11 +186,11 @@ UniValue generatetoaddress(const JSONRPCRequest& request)
|
||||
{
|
||||
if (request.fHelp || request.params.size() < 2 || request.params.size() > 3)
|
||||
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"
|
||||
"\nArguments:\n"
|
||||
"1. numblocks (numeric, required) How many blocks are generated immediately.\n"
|
||||
"2. address (string, required) The address to send the newly generated bitcoin to.\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"
|
||||
"3. maxtries (numeric, optional) How many iterations to try (default = 1000000).\n"
|
||||
"\nResult:\n"
|
||||
"[ blockhashes ] (array) hashes of blocks generated\n"
|
||||
@@ -264,10 +264,10 @@ UniValue prioritisetransaction(const JSONRPCRequest& request)
|
||||
"Accepts the transaction into mined blocks at a higher (or lower) priority\n"
|
||||
"\nArguments:\n"
|
||||
"1. \"txid\" (string, required) The transaction id.\n"
|
||||
"2. priority delta (numeric, required) The priority to add or subtract.\n"
|
||||
"2. priority_delta (numeric, required) The priority to add or subtract.\n"
|
||||
" The transaction selection algorithm considers the tx as it would have a higher priority.\n"
|
||||
" (priority of a transaction is calculated: coinage * value_in_satoshis / txsize) \n"
|
||||
"3. fee delta (numeric, required) The fee value (in satoshis) to add (or subtract, if negative).\n"
|
||||
"3. fee_delta (numeric, required) The fee value (in satoshis) to add (or subtract, if negative).\n"
|
||||
" The fee is not actually paid, only the algorithm for selecting transactions into a block\n"
|
||||
" considers the transaction as it would have paid a higher (or lower) fee.\n"
|
||||
"\nResult:\n"
|
||||
@@ -329,7 +329,7 @@ UniValue getblocktemplate(const JSONRPCRequest& request)
|
||||
" https://github.com/bitcoin/bips/blob/master/bip-0145.mediawiki\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"
|
||||
" \"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"
|
||||
@@ -717,9 +717,9 @@ UniValue submitblock(const JSONRPCRequest& request)
|
||||
"The 'jsonparametersobject' parameter is currently ignored.\n"
|
||||
"See https://en.bitcoin.it/wiki/BIP_0022 for full specification.\n"
|
||||
|
||||
"\nArguments:\n"
|
||||
"1. \"hexdata\" (string, required) the hex-encoded block data to submit\n"
|
||||
"2. \"jsonparametersobject\" (string, optional) object of optional parameters\n"
|
||||
"\nArguments\n"
|
||||
"1. \"hexdata\" (string, required) the hex-encoded block data to submit\n"
|
||||
"2. \"parameters\" (string, optional) object of optional parameters\n"
|
||||
" {\n"
|
||||
" \"workid\" : \"id\" (string, optional) if the server provided a workid, it MUST be included with submissions\n"
|
||||
" }\n"
|
||||
@@ -782,7 +782,7 @@ UniValue estimatefee(const JSONRPCRequest& request)
|
||||
"confirmation within nblocks blocks. Uses virtual transaction size of transaction\n"
|
||||
"as defined in BIP 141 (witness data is discounted).\n"
|
||||
"\nArguments:\n"
|
||||
"1. nblocks (numeric)\n"
|
||||
"1. nblocks (numeric, required)\n"
|
||||
"\nResult:\n"
|
||||
"n (numeric) estimated fee-per-kilobyte\n"
|
||||
"\n"
|
||||
@@ -815,7 +815,7 @@ UniValue estimatepriority(const JSONRPCRequest& request)
|
||||
"\nDEPRECATED. Estimates the approximate priority a zero-fee transaction needs to begin\n"
|
||||
"confirmation within nblocks blocks.\n"
|
||||
"\nArguments:\n"
|
||||
"1. nblocks (numeric)\n"
|
||||
"1. nblocks (numeric, required)\n"
|
||||
"\nResult:\n"
|
||||
"n (numeric) estimated priority\n"
|
||||
"\n"
|
||||
@@ -881,7 +881,7 @@ UniValue estimatesmartpriority(const JSONRPCRequest& request)
|
||||
"confirmation within nblocks blocks if possible and return the number of blocks\n"
|
||||
"for which the estimate is valid.\n"
|
||||
"\nArguments:\n"
|
||||
"1. nblocks (numeric)\n"
|
||||
"1. nblocks (numeric, required)\n"
|
||||
"\nResult:\n"
|
||||
"{\n"
|
||||
" \"priority\" : x.x, (numeric) estimated priority\n"
|
||||
@@ -910,19 +910,19 @@ UniValue estimatesmartpriority(const JSONRPCRequest& request)
|
||||
static const CRPCCommand commands[] =
|
||||
{ // category name actor (function) okSafeMode
|
||||
// --------------------- ------------------------ ----------------------- ----------
|
||||
{ "mining", "getnetworkhashps", &getnetworkhashps, true },
|
||||
{ "mining", "getmininginfo", &getmininginfo, true },
|
||||
{ "mining", "prioritisetransaction", &prioritisetransaction, true },
|
||||
{ "mining", "getblocktemplate", &getblocktemplate, true },
|
||||
{ "mining", "submitblock", &submitblock, true },
|
||||
{ "mining", "getnetworkhashps", &getnetworkhashps, true, {"nblocks","height"} },
|
||||
{ "mining", "getmininginfo", &getmininginfo, true, {} },
|
||||
{ "mining", "prioritisetransaction", &prioritisetransaction, true, {"txid","priority_delta","fee_delta"} },
|
||||
{ "mining", "getblocktemplate", &getblocktemplate, true, {"template_request"} },
|
||||
{ "mining", "submitblock", &submitblock, true, {"hexdata","parameters"} },
|
||||
|
||||
{ "generating", "generate", &generate, true },
|
||||
{ "generating", "generatetoaddress", &generatetoaddress, true },
|
||||
{ "generating", "generate", &generate, true, {"nblocks","maxtries"} },
|
||||
{ "generating", "generatetoaddress", &generatetoaddress, true, {"nblocks","address","maxtries"} },
|
||||
|
||||
{ "util", "estimatefee", &estimatefee, true },
|
||||
{ "util", "estimatepriority", &estimatepriority, true },
|
||||
{ "util", "estimatesmartfee", &estimatesmartfee, true },
|
||||
{ "util", "estimatesmartpriority", &estimatesmartpriority, true },
|
||||
{ "util", "estimatefee", &estimatefee, true, {"nblocks"} },
|
||||
{ "util", "estimatepriority", &estimatepriority, true, {"nblocks"} },
|
||||
{ "util", "estimatesmartfee", &estimatesmartfee, true, {"nblocks"} },
|
||||
{ "util", "estimatesmartpriority", &estimatesmartpriority, true, {"nblocks"} },
|
||||
};
|
||||
|
||||
void RegisterMiningRPCCommands(CRPCTable &t)
|
||||
|
||||
Reference in New Issue
Block a user