RPCHelpMan: Pass through Result and Examples
This commit is contained in:
parent
5eb32d2384
commit
faa1522e5e
11 changed files with 1011 additions and 759 deletions
|
@ -162,14 +162,16 @@ static UniValue getblockcount(const JSONRPCRequest& request)
|
||||||
if (request.fHelp || request.params.size() != 0)
|
if (request.fHelp || request.params.size() != 0)
|
||||||
throw std::runtime_error(
|
throw std::runtime_error(
|
||||||
RPCHelpMan{"getblockcount",
|
RPCHelpMan{"getblockcount",
|
||||||
"\nReturns the number of blocks in the longest blockchain.\n", {}}
|
"\nReturns the number of blocks in the longest blockchain.\n",
|
||||||
.ToString() +
|
{},
|
||||||
"\nResult:\n"
|
RPCResult{
|
||||||
"n (numeric) The current block count\n"
|
"n (numeric) The current block count\n"
|
||||||
"\nExamples:\n"
|
},
|
||||||
+ HelpExampleCli("getblockcount", "")
|
RPCExamples{
|
||||||
|
HelpExampleCli("getblockcount", "")
|
||||||
+ HelpExampleRpc("getblockcount", "")
|
+ HelpExampleRpc("getblockcount", "")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
return chainActive.Height();
|
return chainActive.Height();
|
||||||
|
@ -180,14 +182,16 @@ static UniValue getbestblockhash(const JSONRPCRequest& request)
|
||||||
if (request.fHelp || request.params.size() != 0)
|
if (request.fHelp || request.params.size() != 0)
|
||||||
throw std::runtime_error(
|
throw std::runtime_error(
|
||||||
RPCHelpMan{"getbestblockhash",
|
RPCHelpMan{"getbestblockhash",
|
||||||
"\nReturns the hash of the best (tip) block in the longest blockchain.\n", {}}
|
"\nReturns the hash of the best (tip) block in the longest blockchain.\n",
|
||||||
.ToString() +
|
{},
|
||||||
"\nResult:\n"
|
RPCResult{
|
||||||
"\"hex\" (string) the block hash, hex-encoded\n"
|
"\"hex\" (string) the block hash, hex-encoded\n"
|
||||||
"\nExamples:\n"
|
},
|
||||||
+ HelpExampleCli("getbestblockhash", "")
|
RPCExamples{
|
||||||
|
HelpExampleCli("getbestblockhash", "")
|
||||||
+ HelpExampleRpc("getbestblockhash", "")
|
+ HelpExampleRpc("getbestblockhash", "")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
return chainActive.Tip()->GetBlockHash().GetHex();
|
return chainActive.Tip()->GetBlockHash().GetHex();
|
||||||
|
@ -212,17 +216,18 @@ static UniValue waitfornewblock(const JSONRPCRequest& request)
|
||||||
"\nReturns the current block on timeout or exit.\n",
|
"\nReturns the current block on timeout or exit.\n",
|
||||||
{
|
{
|
||||||
{"timeout", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "0", "Time in milliseconds to wait for a response. 0 indicates no timeout."},
|
{"timeout", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "0", "Time in milliseconds to wait for a response. 0 indicates no timeout."},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResult{
|
||||||
"\nResult:\n"
|
|
||||||
"{ (json object)\n"
|
"{ (json object)\n"
|
||||||
" \"hash\" : { (string) The blockhash\n"
|
" \"hash\" : { (string) The blockhash\n"
|
||||||
" \"height\" : { (int) Block height\n"
|
" \"height\" : { (int) Block height\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\nExamples:\n"
|
},
|
||||||
+ HelpExampleCli("waitfornewblock", "1000")
|
RPCExamples{
|
||||||
|
HelpExampleCli("waitfornewblock", "1000")
|
||||||
+ HelpExampleRpc("waitfornewblock", "1000")
|
+ HelpExampleRpc("waitfornewblock", "1000")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
int timeout = 0;
|
int timeout = 0;
|
||||||
if (!request.params[0].isNull())
|
if (!request.params[0].isNull())
|
||||||
timeout = request.params[0].get_int();
|
timeout = request.params[0].get_int();
|
||||||
|
@ -253,17 +258,18 @@ static UniValue waitforblock(const JSONRPCRequest& request)
|
||||||
{
|
{
|
||||||
{"blockhash", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "Block hash to wait for."},
|
{"blockhash", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "Block hash to wait for."},
|
||||||
{"timeout", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "0", "Time in milliseconds to wait for a response. 0 indicates no timeout."},
|
{"timeout", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "0", "Time in milliseconds to wait for a response. 0 indicates no timeout."},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResult{
|
||||||
"\nResult:\n"
|
|
||||||
"{ (json object)\n"
|
"{ (json object)\n"
|
||||||
" \"hash\" : { (string) The blockhash\n"
|
" \"hash\" : { (string) The blockhash\n"
|
||||||
" \"height\" : { (int) Block height\n"
|
" \"height\" : { (int) Block height\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\nExamples:\n"
|
},
|
||||||
+ HelpExampleCli("waitforblock", "\"0000000000079f8ef3d2c688c244eb7a4570b24c9ed7b4a8c619eb02596f8862\", 1000")
|
RPCExamples{
|
||||||
|
HelpExampleCli("waitforblock", "\"0000000000079f8ef3d2c688c244eb7a4570b24c9ed7b4a8c619eb02596f8862\", 1000")
|
||||||
+ HelpExampleRpc("waitforblock", "\"0000000000079f8ef3d2c688c244eb7a4570b24c9ed7b4a8c619eb02596f8862\", 1000")
|
+ HelpExampleRpc("waitforblock", "\"0000000000079f8ef3d2c688c244eb7a4570b24c9ed7b4a8c619eb02596f8862\", 1000")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
int timeout = 0;
|
int timeout = 0;
|
||||||
|
|
||||||
uint256 hash(ParseHashV(request.params[0], "blockhash"));
|
uint256 hash(ParseHashV(request.params[0], "blockhash"));
|
||||||
|
@ -298,17 +304,18 @@ static UniValue waitforblockheight(const JSONRPCRequest& request)
|
||||||
{
|
{
|
||||||
{"height", RPCArg::Type::NUM, /* opt */ false, /* default_val */ "", "Block height to wait for."},
|
{"height", RPCArg::Type::NUM, /* opt */ false, /* default_val */ "", "Block height to wait for."},
|
||||||
{"timeout", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "0", "Time in milliseconds to wait for a response. 0 indicates no timeout."},
|
{"timeout", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "0", "Time in milliseconds to wait for a response. 0 indicates no timeout."},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResult{
|
||||||
"\nResult:\n"
|
|
||||||
"{ (json object)\n"
|
"{ (json object)\n"
|
||||||
" \"hash\" : { (string) The blockhash\n"
|
" \"hash\" : { (string) The blockhash\n"
|
||||||
" \"height\" : { (int) Block height\n"
|
" \"height\" : { (int) Block height\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\nExamples:\n"
|
},
|
||||||
+ HelpExampleCli("waitforblockheight", "\"100\", 1000")
|
RPCExamples{
|
||||||
|
HelpExampleCli("waitforblockheight", "\"100\", 1000")
|
||||||
+ HelpExampleRpc("waitforblockheight", "\"100\", 1000")
|
+ HelpExampleRpc("waitforblockheight", "\"100\", 1000")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
int timeout = 0;
|
int timeout = 0;
|
||||||
|
|
||||||
int height = request.params[0].get_int();
|
int height = request.params[0].get_int();
|
||||||
|
@ -336,12 +343,14 @@ static UniValue syncwithvalidationinterfacequeue(const JSONRPCRequest& request)
|
||||||
if (request.fHelp || request.params.size() > 0) {
|
if (request.fHelp || request.params.size() > 0) {
|
||||||
throw std::runtime_error(
|
throw std::runtime_error(
|
||||||
RPCHelpMan{"syncwithvalidationinterfacequeue",
|
RPCHelpMan{"syncwithvalidationinterfacequeue",
|
||||||
"\nWaits for the validation interface queue to catch up on everything that was there when we entered this function.\n", {}}
|
"\nWaits for the validation interface queue to catch up on everything that was there when we entered this function.\n",
|
||||||
.ToString() +
|
{},
|
||||||
"\nExamples:\n"
|
RPCResults{},
|
||||||
+ HelpExampleCli("syncwithvalidationinterfacequeue","")
|
RPCExamples{
|
||||||
|
HelpExampleCli("syncwithvalidationinterfacequeue","")
|
||||||
+ HelpExampleRpc("syncwithvalidationinterfacequeue","")
|
+ HelpExampleRpc("syncwithvalidationinterfacequeue","")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
}
|
}
|
||||||
SyncWithValidationInterfaceQueue();
|
SyncWithValidationInterfaceQueue();
|
||||||
return NullUniValue;
|
return NullUniValue;
|
||||||
|
@ -352,14 +361,16 @@ static UniValue getdifficulty(const JSONRPCRequest& request)
|
||||||
if (request.fHelp || request.params.size() != 0)
|
if (request.fHelp || request.params.size() != 0)
|
||||||
throw std::runtime_error(
|
throw std::runtime_error(
|
||||||
RPCHelpMan{"getdifficulty",
|
RPCHelpMan{"getdifficulty",
|
||||||
"\nReturns the proof-of-work difficulty as a multiple of the minimum difficulty.\n", {}}
|
"\nReturns the proof-of-work difficulty as a multiple of the minimum difficulty.\n",
|
||||||
.ToString() +
|
{},
|
||||||
"\nResult:\n"
|
RPCResult{
|
||||||
"n.nnn (numeric) the proof-of-work difficulty as a multiple of the minimum difficulty.\n"
|
"n.nnn (numeric) the proof-of-work difficulty as a multiple of the minimum difficulty.\n"
|
||||||
"\nExamples:\n"
|
},
|
||||||
+ HelpExampleCli("getdifficulty", "")
|
RPCExamples{
|
||||||
|
HelpExampleCli("getdifficulty", "")
|
||||||
+ HelpExampleRpc("getdifficulty", "")
|
+ HelpExampleRpc("getdifficulty", "")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
return GetDifficulty(chainActive.Tip());
|
return GetDifficulty(chainActive.Tip());
|
||||||
|
@ -491,9 +502,8 @@ static UniValue getrawmempool(const JSONRPCRequest& request)
|
||||||
"\nHint: use getmempoolentry to fetch a specific transaction from the mempool.\n",
|
"\nHint: use getmempoolentry to fetch a specific transaction from the mempool.\n",
|
||||||
{
|
{
|
||||||
{"verbose", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "True for a json object, false for array of transaction ids"},
|
{"verbose", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "True for a json object, false for array of transaction ids"},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResult{"for verbose = false",
|
||||||
"\nResult: (for verbose = false):\n"
|
|
||||||
"[ (json array of string)\n"
|
"[ (json array of string)\n"
|
||||||
" \"transactionid\" (string) The transaction id\n"
|
" \"transactionid\" (string) The transaction id\n"
|
||||||
" ,...\n"
|
" ,...\n"
|
||||||
|
@ -504,10 +514,12 @@ static UniValue getrawmempool(const JSONRPCRequest& request)
|
||||||
+ EntryDescriptionString()
|
+ EntryDescriptionString()
|
||||||
+ " }, ...\n"
|
+ " }, ...\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\nExamples:\n"
|
},
|
||||||
+ HelpExampleCli("getrawmempool", "true")
|
RPCExamples{
|
||||||
|
HelpExampleCli("getrawmempool", "true")
|
||||||
+ HelpExampleRpc("getrawmempool", "true")
|
+ HelpExampleRpc("getrawmempool", "true")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
bool fVerbose = false;
|
bool fVerbose = false;
|
||||||
if (!request.params[0].isNull())
|
if (!request.params[0].isNull())
|
||||||
|
@ -525,23 +537,27 @@ static UniValue getmempoolancestors(const JSONRPCRequest& request)
|
||||||
{
|
{
|
||||||
{"txid", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The transaction id (must be in mempool)"},
|
{"txid", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The transaction id (must be in mempool)"},
|
||||||
{"verbose", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "True for a json object, false for array of transaction ids"},
|
{"verbose", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "True for a json object, false for array of transaction ids"},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
{
|
||||||
"\nResult (for verbose = false):\n"
|
RPCResult{"for verbose = false",
|
||||||
"[ (json array of strings)\n"
|
"[ (json array of strings)\n"
|
||||||
" \"transactionid\" (string) The transaction id of an in-mempool ancestor transaction\n"
|
" \"transactionid\" (string) The transaction id of an in-mempool ancestor transaction\n"
|
||||||
" ,...\n"
|
" ,...\n"
|
||||||
"]\n"
|
"]\n"
|
||||||
"\nResult (for verbose = true):\n"
|
},
|
||||||
|
RPCResult{"for verbose = true",
|
||||||
"{ (json object)\n"
|
"{ (json object)\n"
|
||||||
" \"transactionid\" : { (json object)\n"
|
" \"transactionid\" : { (json object)\n"
|
||||||
+ EntryDescriptionString()
|
+ EntryDescriptionString()
|
||||||
+ " }, ...\n"
|
+ " }, ...\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\nExamples:\n"
|
},
|
||||||
+ HelpExampleCli("getmempoolancestors", "\"mytxid\"")
|
},
|
||||||
|
RPCExamples{
|
||||||
|
HelpExampleCli("getmempoolancestors", "\"mytxid\"")
|
||||||
+ HelpExampleRpc("getmempoolancestors", "\"mytxid\"")
|
+ HelpExampleRpc("getmempoolancestors", "\"mytxid\"")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool fVerbose = false;
|
bool fVerbose = false;
|
||||||
|
@ -591,23 +607,27 @@ static UniValue getmempooldescendants(const JSONRPCRequest& request)
|
||||||
{
|
{
|
||||||
{"txid", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The transaction id (must be in mempool)"},
|
{"txid", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The transaction id (must be in mempool)"},
|
||||||
{"verbose", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "True for a json object, false for array of transaction ids"},
|
{"verbose", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "True for a json object, false for array of transaction ids"},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
{
|
||||||
"\nResult (for verbose = false):\n"
|
RPCResult{"for verbose = false",
|
||||||
"[ (json array of strings)\n"
|
"[ (json array of strings)\n"
|
||||||
" \"transactionid\" (string) The transaction id of an in-mempool descendant transaction\n"
|
" \"transactionid\" (string) The transaction id of an in-mempool descendant transaction\n"
|
||||||
" ,...\n"
|
" ,...\n"
|
||||||
"]\n"
|
"]\n"
|
||||||
"\nResult (for verbose = true):\n"
|
},
|
||||||
|
RPCResult{"for verbose = true",
|
||||||
"{ (json object)\n"
|
"{ (json object)\n"
|
||||||
" \"transactionid\" : { (json object)\n"
|
" \"transactionid\" : { (json object)\n"
|
||||||
+ EntryDescriptionString()
|
+ EntryDescriptionString()
|
||||||
+ " }, ...\n"
|
+ " }, ...\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\nExamples:\n"
|
},
|
||||||
+ HelpExampleCli("getmempooldescendants", "\"mytxid\"")
|
},
|
||||||
|
RPCExamples{
|
||||||
|
HelpExampleCli("getmempooldescendants", "\"mytxid\"")
|
||||||
+ HelpExampleRpc("getmempooldescendants", "\"mytxid\"")
|
+ HelpExampleRpc("getmempooldescendants", "\"mytxid\"")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool fVerbose = false;
|
bool fVerbose = false;
|
||||||
|
@ -656,16 +676,17 @@ static UniValue getmempoolentry(const JSONRPCRequest& request)
|
||||||
"\nReturns mempool data for given transaction\n",
|
"\nReturns mempool data for given transaction\n",
|
||||||
{
|
{
|
||||||
{"txid", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The transaction id (must be in mempool)"},
|
{"txid", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The transaction id (must be in mempool)"},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResult{
|
||||||
"\nResult:\n"
|
|
||||||
"{ (json object)\n"
|
"{ (json object)\n"
|
||||||
+ EntryDescriptionString()
|
+ EntryDescriptionString()
|
||||||
+ "}\n"
|
+ "}\n"
|
||||||
"\nExamples:\n"
|
},
|
||||||
+ HelpExampleCli("getmempoolentry", "\"mytxid\"")
|
RPCExamples{
|
||||||
|
HelpExampleCli("getmempoolentry", "\"mytxid\"")
|
||||||
+ HelpExampleRpc("getmempoolentry", "\"mytxid\"")
|
+ HelpExampleRpc("getmempoolentry", "\"mytxid\"")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
uint256 hash = ParseHashV(request.params[0], "parameter 1");
|
uint256 hash = ParseHashV(request.params[0], "parameter 1");
|
||||||
|
@ -691,14 +712,15 @@ static UniValue getblockhash(const JSONRPCRequest& request)
|
||||||
"\nReturns hash of block in best-block-chain at height provided.\n",
|
"\nReturns hash of block in best-block-chain at height provided.\n",
|
||||||
{
|
{
|
||||||
{"height", RPCArg::Type::NUM, /* opt */ false, /* default_val */ "", "The height index"},
|
{"height", RPCArg::Type::NUM, /* opt */ false, /* default_val */ "", "The height index"},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResult{
|
||||||
"\nResult:\n"
|
|
||||||
"\"hash\" (string) The block hash\n"
|
"\"hash\" (string) The block hash\n"
|
||||||
"\nExamples:\n"
|
},
|
||||||
+ HelpExampleCli("getblockhash", "1000")
|
RPCExamples{
|
||||||
|
HelpExampleCli("getblockhash", "1000")
|
||||||
+ HelpExampleRpc("getblockhash", "1000")
|
+ HelpExampleRpc("getblockhash", "1000")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
|
|
||||||
|
@ -720,9 +742,9 @@ static UniValue getblockheader(const JSONRPCRequest& request)
|
||||||
{
|
{
|
||||||
{"blockhash", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The block hash"},
|
{"blockhash", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The block hash"},
|
||||||
{"verbose", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "true", "true for a json object, false for the hex-encoded data"},
|
{"verbose", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "true", "true for a json object, false for the hex-encoded data"},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
{
|
||||||
"\nResult (for verbose = true):\n"
|
RPCResult{"for verbose = true",
|
||||||
"{\n"
|
"{\n"
|
||||||
" \"hash\" : \"hash\", (string) the block hash (same as provided)\n"
|
" \"hash\" : \"hash\", (string) the block hash (same as provided)\n"
|
||||||
" \"confirmations\" : n, (numeric) The number of confirmations, or -1 if the block is not on the main chain\n"
|
" \"confirmations\" : n, (numeric) The number of confirmations, or -1 if the block is not on the main chain\n"
|
||||||
|
@ -740,12 +762,16 @@ static UniValue getblockheader(const JSONRPCRequest& request)
|
||||||
" \"previousblockhash\" : \"hash\", (string) The hash of the previous block\n"
|
" \"previousblockhash\" : \"hash\", (string) The hash of the previous block\n"
|
||||||
" \"nextblockhash\" : \"hash\", (string) The hash of the next block\n"
|
" \"nextblockhash\" : \"hash\", (string) The hash of the next block\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\nResult (for verbose=false):\n"
|
},
|
||||||
|
RPCResult{"for verbose=false",
|
||||||
"\"data\" (string) A string that is serialized, hex-encoded data for block 'hash'.\n"
|
"\"data\" (string) A string that is serialized, hex-encoded data for block 'hash'.\n"
|
||||||
"\nExamples:\n"
|
},
|
||||||
+ HelpExampleCli("getblockheader", "\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\"")
|
},
|
||||||
|
RPCExamples{
|
||||||
|
HelpExampleCli("getblockheader", "\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\"")
|
||||||
+ HelpExampleRpc("getblockheader", "\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\"")
|
+ HelpExampleRpc("getblockheader", "\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\"")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
uint256 hash(ParseHashV(request.params[0], "hash"));
|
uint256 hash(ParseHashV(request.params[0], "hash"));
|
||||||
|
|
||||||
|
@ -806,11 +832,12 @@ static UniValue getblock(const JSONRPCRequest& request)
|
||||||
{
|
{
|
||||||
{"blockhash", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The block hash"},
|
{"blockhash", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The block hash"},
|
||||||
{"verbosity", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "1", "0 for hex-encoded data, 1 for a json object, and 2 for json object with transaction data"},
|
{"verbosity", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "1", "0 for hex-encoded data, 1 for a json object, and 2 for json object with transaction data"},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
{
|
||||||
"\nResult (for verbosity = 0):\n"
|
RPCResult{"for verbosity = 0",
|
||||||
"\"data\" (string) A string that is serialized, hex-encoded data for block 'hash'.\n"
|
"\"data\" (string) A string that is serialized, hex-encoded data for block 'hash'.\n"
|
||||||
"\nResult (for verbosity = 1):\n"
|
},
|
||||||
|
RPCResult{"for verbosity = 1",
|
||||||
"{\n"
|
"{\n"
|
||||||
" \"hash\" : \"hash\", (string) the block hash (same as provided)\n"
|
" \"hash\" : \"hash\", (string) the block hash (same as provided)\n"
|
||||||
" \"confirmations\" : n, (numeric) The number of confirmations, or -1 if the block is not on the main chain\n"
|
" \"confirmations\" : n, (numeric) The number of confirmations, or -1 if the block is not on the main chain\n"
|
||||||
|
@ -835,7 +862,8 @@ static UniValue getblock(const JSONRPCRequest& request)
|
||||||
" \"previousblockhash\" : \"hash\", (string) The hash of the previous block\n"
|
" \"previousblockhash\" : \"hash\", (string) The hash of the previous block\n"
|
||||||
" \"nextblockhash\" : \"hash\" (string) The hash of the next block\n"
|
" \"nextblockhash\" : \"hash\" (string) The hash of the next block\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\nResult (for verbosity = 2):\n"
|
},
|
||||||
|
RPCResult{"for verbosity = 2",
|
||||||
"{\n"
|
"{\n"
|
||||||
" ..., Same output as verbosity = 1.\n"
|
" ..., Same output as verbosity = 1.\n"
|
||||||
" \"tx\" : [ (array of Objects) The transactions in the format of the getrawtransaction RPC. Different from verbosity = 1 \"tx\" result.\n"
|
" \"tx\" : [ (array of Objects) The transactions in the format of the getrawtransaction RPC. Different from verbosity = 1 \"tx\" result.\n"
|
||||||
|
@ -843,10 +871,13 @@ static UniValue getblock(const JSONRPCRequest& request)
|
||||||
" ],\n"
|
" ],\n"
|
||||||
" ,... Same output as verbosity = 1.\n"
|
" ,... Same output as verbosity = 1.\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\nExamples:\n"
|
},
|
||||||
+ HelpExampleCli("getblock", "\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\"")
|
},
|
||||||
|
RPCExamples{
|
||||||
|
HelpExampleCli("getblock", "\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\"")
|
||||||
+ HelpExampleRpc("getblock", "\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\"")
|
+ HelpExampleRpc("getblock", "\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\"")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
|
|
||||||
|
@ -957,13 +988,15 @@ static UniValue pruneblockchain(const JSONRPCRequest& request)
|
||||||
{
|
{
|
||||||
{"height", RPCArg::Type::NUM, /* opt */ false, /* default_val */ "", "The block height to prune up to. May be set to a discrete height, or a unix timestamp\n"
|
{"height", RPCArg::Type::NUM, /* opt */ false, /* default_val */ "", "The block height to prune up to. May be set to a discrete height, or a unix timestamp\n"
|
||||||
" to prune blocks whose block time is at least 2 hours older than the provided timestamp."},
|
" to prune blocks whose block time is at least 2 hours older than the provided timestamp."},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResult{
|
||||||
"\nResult:\n"
|
|
||||||
"n (numeric) Height of the last block pruned.\n"
|
"n (numeric) Height of the last block pruned.\n"
|
||||||
"\nExamples:\n"
|
},
|
||||||
+ HelpExampleCli("pruneblockchain", "1000")
|
RPCExamples{
|
||||||
+ HelpExampleRpc("pruneblockchain", "1000"));
|
HelpExampleCli("pruneblockchain", "1000")
|
||||||
|
+ HelpExampleRpc("pruneblockchain", "1000")
|
||||||
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
if (!fPruneMode)
|
if (!fPruneMode)
|
||||||
throw JSONRPCError(RPC_MISC_ERROR, "Cannot prune blocks because node is not in prune mode.");
|
throw JSONRPCError(RPC_MISC_ERROR, "Cannot prune blocks because node is not in prune mode.");
|
||||||
|
@ -1007,9 +1040,8 @@ static UniValue gettxoutsetinfo(const JSONRPCRequest& request)
|
||||||
RPCHelpMan{"gettxoutsetinfo",
|
RPCHelpMan{"gettxoutsetinfo",
|
||||||
"\nReturns statistics about the unspent transaction output set.\n"
|
"\nReturns statistics about the unspent transaction output set.\n"
|
||||||
"Note this call may take some time.\n",
|
"Note this call may take some time.\n",
|
||||||
{}}
|
{},
|
||||||
.ToString() +
|
RPCResult{
|
||||||
"\nResult:\n"
|
|
||||||
"{\n"
|
"{\n"
|
||||||
" \"height\":n, (numeric) The current block height (index)\n"
|
" \"height\":n, (numeric) The current block height (index)\n"
|
||||||
" \"bestblock\": \"hex\", (string) The hash of the block at the tip of the chain\n"
|
" \"bestblock\": \"hex\", (string) The hash of the block at the tip of the chain\n"
|
||||||
|
@ -1020,10 +1052,12 @@ static UniValue gettxoutsetinfo(const JSONRPCRequest& request)
|
||||||
" \"disk_size\": n, (numeric) The estimated size of the chainstate on disk\n"
|
" \"disk_size\": n, (numeric) The estimated size of the chainstate on disk\n"
|
||||||
" \"total_amount\": x.xxx (numeric) The total amount\n"
|
" \"total_amount\": x.xxx (numeric) The total amount\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\nExamples:\n"
|
},
|
||||||
+ HelpExampleCli("gettxoutsetinfo", "")
|
RPCExamples{
|
||||||
|
HelpExampleCli("gettxoutsetinfo", "")
|
||||||
+ HelpExampleRpc("gettxoutsetinfo", "")
|
+ HelpExampleRpc("gettxoutsetinfo", "")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
UniValue ret(UniValue::VOBJ);
|
UniValue ret(UniValue::VOBJ);
|
||||||
|
|
||||||
|
@ -1054,9 +1088,8 @@ UniValue gettxout(const JSONRPCRequest& request)
|
||||||
{"txid", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The transaction id"},
|
{"txid", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The transaction id"},
|
||||||
{"n", RPCArg::Type::NUM, /* opt */ false, /* default_val */ "", "vout number"},
|
{"n", RPCArg::Type::NUM, /* opt */ false, /* default_val */ "", "vout number"},
|
||||||
{"include_mempool", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "true", "Whether to include the mempool. Note that an unspent output that is spent in the mempool won't appear."},
|
{"include_mempool", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "true", "Whether to include the mempool. Note that an unspent output that is spent in the mempool won't appear."},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResult{
|
||||||
"\nResult:\n"
|
|
||||||
"{\n"
|
"{\n"
|
||||||
" \"bestblock\": \"hash\", (string) The hash of the block at the tip of the chain\n"
|
" \"bestblock\": \"hash\", (string) The hash of the block at the tip of the chain\n"
|
||||||
" \"confirmations\" : n, (numeric) The number of confirmations\n"
|
" \"confirmations\" : n, (numeric) The number of confirmations\n"
|
||||||
|
@ -1073,15 +1106,16 @@ UniValue gettxout(const JSONRPCRequest& request)
|
||||||
" },\n"
|
" },\n"
|
||||||
" \"coinbase\" : true|false (boolean) Coinbase or not\n"
|
" \"coinbase\" : true|false (boolean) Coinbase or not\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
|
},
|
||||||
"\nExamples:\n"
|
RPCExamples{
|
||||||
"\nGet unspent transactions\n"
|
"\nGet unspent transactions\n"
|
||||||
+ HelpExampleCli("listunspent", "") +
|
+ HelpExampleCli("listunspent", "") +
|
||||||
"\nView the details\n"
|
"\nView the details\n"
|
||||||
+ HelpExampleCli("gettxout", "\"txid\" 1") +
|
+ HelpExampleCli("gettxout", "\"txid\" 1") +
|
||||||
"\nAs a JSON-RPC call\n"
|
"\nAs a JSON-RPC call\n"
|
||||||
+ HelpExampleRpc("gettxout", "\"txid\", 1")
|
+ HelpExampleRpc("gettxout", "\"txid\", 1")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
|
|
||||||
|
@ -1134,14 +1168,15 @@ static UniValue verifychain(const JSONRPCRequest& request)
|
||||||
{
|
{
|
||||||
{"checklevel", RPCArg::Type::NUM, /* opt */ true, /* default_val */ strprintf("%d, range=0-4", nCheckLevel), "How thorough the block verification is."},
|
{"checklevel", RPCArg::Type::NUM, /* opt */ true, /* default_val */ strprintf("%d, range=0-4", nCheckLevel), "How thorough the block verification is."},
|
||||||
{"nblocks", RPCArg::Type::NUM, /* opt */ true, /* default_val */ strprintf("%d, 0=all", nCheckDepth), "The number of blocks to check."},
|
{"nblocks", RPCArg::Type::NUM, /* opt */ true, /* default_val */ strprintf("%d, 0=all", nCheckDepth), "The number of blocks to check."},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResult{
|
||||||
"\nResult:\n"
|
|
||||||
"true|false (boolean) Verified or not\n"
|
"true|false (boolean) Verified or not\n"
|
||||||
"\nExamples:\n"
|
},
|
||||||
+ HelpExampleCli("verifychain", "")
|
RPCExamples{
|
||||||
|
HelpExampleCli("verifychain", "")
|
||||||
+ HelpExampleRpc("verifychain", "")
|
+ HelpExampleRpc("verifychain", "")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
|
|
||||||
|
@ -1229,9 +1264,9 @@ UniValue getblockchaininfo(const JSONRPCRequest& request)
|
||||||
if (request.fHelp || request.params.size() != 0)
|
if (request.fHelp || request.params.size() != 0)
|
||||||
throw std::runtime_error(
|
throw std::runtime_error(
|
||||||
RPCHelpMan{"getblockchaininfo",
|
RPCHelpMan{"getblockchaininfo",
|
||||||
"Returns an object containing various state info regarding blockchain processing.\n", {}}
|
"Returns an object containing various state info regarding blockchain processing.\n",
|
||||||
.ToString() +
|
{},
|
||||||
"\nResult:\n"
|
RPCResult{
|
||||||
"{\n"
|
"{\n"
|
||||||
" \"chain\": \"xxxx\", (string) current network name as defined in BIP70 (main, test, regtest)\n"
|
" \"chain\": \"xxxx\", (string) current network name as defined in BIP70 (main, test, regtest)\n"
|
||||||
" \"blocks\": xxxxxx, (numeric) the current number of blocks processed in the server\n"
|
" \"blocks\": xxxxxx, (numeric) the current number of blocks processed in the server\n"
|
||||||
|
@ -1274,10 +1309,12 @@ UniValue getblockchaininfo(const JSONRPCRequest& request)
|
||||||
" }\n"
|
" }\n"
|
||||||
" \"warnings\" : \"...\", (string) any network and blockchain warnings.\n"
|
" \"warnings\" : \"...\", (string) any network and blockchain warnings.\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\nExamples:\n"
|
},
|
||||||
+ HelpExampleCli("getblockchaininfo", "")
|
RPCExamples{
|
||||||
|
HelpExampleCli("getblockchaininfo", "")
|
||||||
+ HelpExampleRpc("getblockchaininfo", "")
|
+ HelpExampleRpc("getblockchaininfo", "")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
|
|
||||||
|
@ -1349,9 +1386,8 @@ static UniValue getchaintips(const JSONRPCRequest& request)
|
||||||
RPCHelpMan{"getchaintips",
|
RPCHelpMan{"getchaintips",
|
||||||
"Return information about all known tips in the block tree,"
|
"Return information about all known tips in the block tree,"
|
||||||
" including the main chain as well as orphaned branches.\n",
|
" including the main chain as well as orphaned branches.\n",
|
||||||
{}}
|
{},
|
||||||
.ToString() +
|
RPCResult{
|
||||||
"\nResult:\n"
|
|
||||||
"[\n"
|
"[\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
" \"height\": xxxx, (numeric) height of the chain tip\n"
|
" \"height\": xxxx, (numeric) height of the chain tip\n"
|
||||||
|
@ -1372,10 +1408,12 @@ static UniValue getchaintips(const JSONRPCRequest& request)
|
||||||
"3. \"valid-headers\" All blocks are available for this branch, but they were never fully validated\n"
|
"3. \"valid-headers\" All blocks are available for this branch, but they were never fully validated\n"
|
||||||
"4. \"valid-fork\" This branch is not part of the active chain, but is fully validated\n"
|
"4. \"valid-fork\" This branch is not part of the active chain, but is fully validated\n"
|
||||||
"5. \"active\" This is the tip of the active main chain, which is certainly valid\n"
|
"5. \"active\" This is the tip of the active main chain, which is certainly valid\n"
|
||||||
"\nExamples:\n"
|
},
|
||||||
+ HelpExampleCli("getchaintips", "")
|
RPCExamples{
|
||||||
|
HelpExampleCli("getchaintips", "")
|
||||||
+ HelpExampleRpc("getchaintips", "")
|
+ HelpExampleRpc("getchaintips", "")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
|
|
||||||
|
@ -1466,9 +1504,9 @@ static UniValue getmempoolinfo(const JSONRPCRequest& request)
|
||||||
if (request.fHelp || request.params.size() != 0)
|
if (request.fHelp || request.params.size() != 0)
|
||||||
throw std::runtime_error(
|
throw std::runtime_error(
|
||||||
RPCHelpMan{"getmempoolinfo",
|
RPCHelpMan{"getmempoolinfo",
|
||||||
"\nReturns details on the active state of the TX memory pool.\n", {}}
|
"\nReturns details on the active state of the TX memory pool.\n",
|
||||||
.ToString() +
|
{},
|
||||||
"\nResult:\n"
|
RPCResult{
|
||||||
"{\n"
|
"{\n"
|
||||||
" \"size\": xxxxx, (numeric) Current tx count\n"
|
" \"size\": xxxxx, (numeric) Current tx count\n"
|
||||||
" \"bytes\": xxxxx, (numeric) Sum of all virtual transaction sizes as defined in BIP 141. Differs from actual serialized size because witness data is discounted\n"
|
" \"bytes\": xxxxx, (numeric) Sum of all virtual transaction sizes as defined in BIP 141. Differs from actual serialized size because witness data is discounted\n"
|
||||||
|
@ -1477,10 +1515,12 @@ static UniValue getmempoolinfo(const JSONRPCRequest& request)
|
||||||
" \"mempoolminfee\": xxxxx (numeric) Minimum fee rate in " + CURRENCY_UNIT + "/kB for tx to be accepted. Is the maximum of minrelaytxfee and minimum mempool fee\n"
|
" \"mempoolminfee\": xxxxx (numeric) Minimum fee rate in " + CURRENCY_UNIT + "/kB for tx to be accepted. Is the maximum of minrelaytxfee and minimum mempool fee\n"
|
||||||
" \"minrelaytxfee\": xxxxx (numeric) Current minimum relay fee for transactions\n"
|
" \"minrelaytxfee\": xxxxx (numeric) Current minimum relay fee for transactions\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\nExamples:\n"
|
},
|
||||||
+ HelpExampleCli("getmempoolinfo", "")
|
RPCExamples{
|
||||||
|
HelpExampleCli("getmempoolinfo", "")
|
||||||
+ HelpExampleRpc("getmempoolinfo", "")
|
+ HelpExampleRpc("getmempoolinfo", "")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
return mempoolInfoToJSON();
|
return mempoolInfoToJSON();
|
||||||
}
|
}
|
||||||
|
@ -1495,13 +1535,13 @@ static UniValue preciousblock(const JSONRPCRequest& request)
|
||||||
"\nThe effects of preciousblock are not retained across restarts.\n",
|
"\nThe effects of preciousblock are not retained across restarts.\n",
|
||||||
{
|
{
|
||||||
{"blockhash", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "the hash of the block to mark as precious"},
|
{"blockhash", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "the hash of the block to mark as precious"},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResults{},
|
||||||
"\nResult:\n"
|
RPCExamples{
|
||||||
"\nExamples:\n"
|
HelpExampleCli("preciousblock", "\"blockhash\"")
|
||||||
+ HelpExampleCli("preciousblock", "\"blockhash\"")
|
|
||||||
+ HelpExampleRpc("preciousblock", "\"blockhash\"")
|
+ HelpExampleRpc("preciousblock", "\"blockhash\"")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
uint256 hash(ParseHashV(request.params[0], "blockhash"));
|
uint256 hash(ParseHashV(request.params[0], "blockhash"));
|
||||||
CBlockIndex* pblockindex;
|
CBlockIndex* pblockindex;
|
||||||
|
@ -1532,13 +1572,13 @@ static UniValue invalidateblock(const JSONRPCRequest& request)
|
||||||
"\nPermanently marks a block as invalid, as if it violated a consensus rule.\n",
|
"\nPermanently marks a block as invalid, as if it violated a consensus rule.\n",
|
||||||
{
|
{
|
||||||
{"blockhash", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "the hash of the block to mark as invalid"},
|
{"blockhash", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "the hash of the block to mark as invalid"},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResults{},
|
||||||
"\nResult:\n"
|
RPCExamples{
|
||||||
"\nExamples:\n"
|
HelpExampleCli("invalidateblock", "\"blockhash\"")
|
||||||
+ HelpExampleCli("invalidateblock", "\"blockhash\"")
|
|
||||||
+ HelpExampleRpc("invalidateblock", "\"blockhash\"")
|
+ HelpExampleRpc("invalidateblock", "\"blockhash\"")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
uint256 hash(ParseHashV(request.params[0], "blockhash"));
|
uint256 hash(ParseHashV(request.params[0], "blockhash"));
|
||||||
CValidationState state;
|
CValidationState state;
|
||||||
|
@ -1573,13 +1613,13 @@ static UniValue reconsiderblock(const JSONRPCRequest& request)
|
||||||
"This can be used to undo the effects of invalidateblock.\n",
|
"This can be used to undo the effects of invalidateblock.\n",
|
||||||
{
|
{
|
||||||
{"blockhash", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "the hash of the block to reconsider"},
|
{"blockhash", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "the hash of the block to reconsider"},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResults{},
|
||||||
"\nResult:\n"
|
RPCExamples{
|
||||||
"\nExamples:\n"
|
HelpExampleCli("reconsiderblock", "\"blockhash\"")
|
||||||
+ HelpExampleCli("reconsiderblock", "\"blockhash\"")
|
|
||||||
+ HelpExampleRpc("reconsiderblock", "\"blockhash\"")
|
+ HelpExampleRpc("reconsiderblock", "\"blockhash\"")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
uint256 hash(ParseHashV(request.params[0], "blockhash"));
|
uint256 hash(ParseHashV(request.params[0], "blockhash"));
|
||||||
|
|
||||||
|
@ -1612,9 +1652,8 @@ static UniValue getchaintxstats(const JSONRPCRequest& request)
|
||||||
{
|
{
|
||||||
{"nblocks", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "one month", "Size of the window in number of blocks"},
|
{"nblocks", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "one month", "Size of the window in number of blocks"},
|
||||||
{"blockhash", RPCArg::Type::STR_HEX, /* opt */ true, /* default_val */ "chain tip", "The hash of the block that ends the window."},
|
{"blockhash", RPCArg::Type::STR_HEX, /* opt */ true, /* default_val */ "chain tip", "The hash of the block that ends the window."},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResult{
|
||||||
"\nResult:\n"
|
|
||||||
"{\n"
|
"{\n"
|
||||||
" \"time\": xxxxx, (numeric) The timestamp for the final block in the window in UNIX format.\n"
|
" \"time\": xxxxx, (numeric) The timestamp for the final block in the window in UNIX format.\n"
|
||||||
" \"txcount\": xxxxx, (numeric) The total number of transactions in the chain up to that point.\n"
|
" \"txcount\": xxxxx, (numeric) The total number of transactions in the chain up to that point.\n"
|
||||||
|
@ -1624,10 +1663,12 @@ static UniValue getchaintxstats(const JSONRPCRequest& request)
|
||||||
" \"window_interval\": xxxxx, (numeric) The elapsed time in the window in seconds. Only returned if \"window_block_count\" is > 0.\n"
|
" \"window_interval\": xxxxx, (numeric) The elapsed time in the window in seconds. Only returned if \"window_block_count\" is > 0.\n"
|
||||||
" \"txrate\": x.xx, (numeric) The average rate of transactions per second in the window. Only returned if \"window_interval\" is > 0.\n"
|
" \"txrate\": x.xx, (numeric) The average rate of transactions per second in the window. Only returned if \"window_interval\" is > 0.\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\nExamples:\n"
|
},
|
||||||
+ HelpExampleCli("getchaintxstats", "")
|
RPCExamples{
|
||||||
|
HelpExampleCli("getchaintxstats", "")
|
||||||
+ HelpExampleRpc("getchaintxstats", "2016")
|
+ HelpExampleRpc("getchaintxstats", "2016")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
const CBlockIndex* pindex;
|
const CBlockIndex* pindex;
|
||||||
int blockcount = 30 * 24 * 60 * 60 / Params().GetConsensus().nPowTargetSpacing; // By default: 1 month
|
int blockcount = 30 * 24 * 60 * 60 / Params().GetConsensus().nPowTargetSpacing; // By default: 1 month
|
||||||
|
@ -1751,9 +1792,8 @@ static UniValue getblockstats(const JSONRPCRequest& request)
|
||||||
{"time", RPCArg::Type::STR, /* opt */ true, /* default_val */ "", "Selected statistic"},
|
{"time", RPCArg::Type::STR, /* opt */ true, /* default_val */ "", "Selected statistic"},
|
||||||
},
|
},
|
||||||
"stats"},
|
"stats"},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResult{
|
||||||
"\nResult:\n"
|
|
||||||
"{ (json object)\n"
|
"{ (json object)\n"
|
||||||
" \"avgfee\": xxxxx, (numeric) Average fee in the block\n"
|
" \"avgfee\": xxxxx, (numeric) Average fee in the block\n"
|
||||||
" \"avgfeerate\": xxxxx, (numeric) Average feerate (in satoshis per virtual byte)\n"
|
" \"avgfeerate\": xxxxx, (numeric) Average feerate (in satoshis per virtual byte)\n"
|
||||||
|
@ -1791,10 +1831,12 @@ static UniValue getblockstats(const JSONRPCRequest& request)
|
||||||
" \"utxo_increase\": xxxxx, (numeric) The increase/decrease in the number of unspent outputs\n"
|
" \"utxo_increase\": xxxxx, (numeric) The increase/decrease in the number of unspent outputs\n"
|
||||||
" \"utxo_size_inc\": xxxxx, (numeric) The increase/decrease in size for the utxo index (not discounting op_return and similar)\n"
|
" \"utxo_size_inc\": xxxxx, (numeric) The increase/decrease in size for the utxo index (not discounting op_return and similar)\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\nExamples:\n"
|
},
|
||||||
+ HelpExampleCli("getblockstats", "1000 '[\"minfeerate\",\"avgfeerate\"]'")
|
RPCExamples{
|
||||||
|
HelpExampleCli("getblockstats", "1000 '[\"minfeerate\",\"avgfeerate\"]'")
|
||||||
+ HelpExampleRpc("getblockstats", "1000 '[\"minfeerate\",\"avgfeerate\"]'")
|
+ HelpExampleRpc("getblockstats", "1000 '[\"minfeerate\",\"avgfeerate\"]'")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
|
@ -2006,12 +2048,14 @@ static UniValue savemempool(const JSONRPCRequest& request)
|
||||||
if (request.fHelp || request.params.size() != 0) {
|
if (request.fHelp || request.params.size() != 0) {
|
||||||
throw std::runtime_error(
|
throw std::runtime_error(
|
||||||
RPCHelpMan{"savemempool",
|
RPCHelpMan{"savemempool",
|
||||||
"\nDumps the mempool to disk. It will fail until the previous dump is fully loaded.\n", {}}
|
"\nDumps the mempool to disk. It will fail until the previous dump is fully loaded.\n",
|
||||||
.ToString() +
|
{},
|
||||||
"\nExamples:\n"
|
RPCResults{},
|
||||||
+ HelpExampleCli("savemempool", "")
|
RPCExamples{
|
||||||
|
HelpExampleCli("savemempool", "")
|
||||||
+ HelpExampleRpc("savemempool", "")
|
+ HelpExampleRpc("savemempool", "")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!g_is_mempool_loaded) {
|
if (!g_is_mempool_loaded) {
|
||||||
|
@ -2120,9 +2164,8 @@ UniValue scantxoutset(const JSONRPCRequest& request)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"[scanobjects,...]"},
|
"[scanobjects,...]"},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResult{
|
||||||
"\nResult:\n"
|
|
||||||
"{\n"
|
"{\n"
|
||||||
" \"unspents\": [\n"
|
" \"unspents\": [\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
|
@ -2136,6 +2179,9 @@ UniValue scantxoutset(const JSONRPCRequest& request)
|
||||||
" ,...], \n"
|
" ,...], \n"
|
||||||
" \"total_amount\" : x.xxx, (numeric) The total amount of all found unspent outputs in " + CURRENCY_UNIT + "\n"
|
" \"total_amount\" : x.xxx, (numeric) The total amount of all found unspent outputs in " + CURRENCY_UNIT + "\n"
|
||||||
"]\n"
|
"]\n"
|
||||||
|
},
|
||||||
|
RPCExamples{""},
|
||||||
|
}.ToString()
|
||||||
);
|
);
|
||||||
|
|
||||||
RPCTypeCheck(request.params, {UniValue::VSTR, UniValue::VARR});
|
RPCTypeCheck(request.params, {UniValue::VSTR, UniValue::VARR});
|
||||||
|
|
|
@ -94,14 +94,15 @@ static UniValue getnetworkhashps(const JSONRPCRequest& request)
|
||||||
{
|
{
|
||||||
{"nblocks", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "120", "The number of blocks, or -1 for blocks since last difficulty change."},
|
{"nblocks", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "120", "The number of blocks, or -1 for blocks since last difficulty change."},
|
||||||
{"height", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "-1", "To estimate at the time of the given height."},
|
{"height", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "-1", "To estimate at the time of the given height."},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResult{
|
||||||
"\nResult:\n"
|
|
||||||
"x (numeric) Hashes per second estimated\n"
|
"x (numeric) Hashes per second estimated\n"
|
||||||
"\nExamples:\n"
|
},
|
||||||
+ HelpExampleCli("getnetworkhashps", "")
|
RPCExamples{
|
||||||
|
HelpExampleCli("getnetworkhashps", "")
|
||||||
+ HelpExampleRpc("getnetworkhashps", "")
|
+ HelpExampleRpc("getnetworkhashps", "")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
return GetNetworkHashPS(!request.params[0].isNull() ? request.params[0].get_int() : 120, !request.params[1].isNull() ? request.params[1].get_int() : -1);
|
return GetNetworkHashPS(!request.params[0].isNull() ? request.params[0].get_int() : 120, !request.params[1].isNull() ? request.params[1].get_int() : -1);
|
||||||
|
@ -165,16 +166,17 @@ static UniValue generatetoaddress(const JSONRPCRequest& request)
|
||||||
{"nblocks", RPCArg::Type::NUM, /* opt */ false, /* default_val */ "", "How many blocks are generated immediately."},
|
{"nblocks", RPCArg::Type::NUM, /* opt */ false, /* default_val */ "", "How many blocks are generated immediately."},
|
||||||
{"address", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The address to send the newly generated bitcoin to."},
|
{"address", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The address to send the newly generated bitcoin to."},
|
||||||
{"maxtries", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "1000000", "How many iterations to try."},
|
{"maxtries", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "1000000", "How many iterations to try."},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResult{
|
||||||
"\nResult:\n"
|
|
||||||
"[ blockhashes ] (array) hashes of blocks generated\n"
|
"[ blockhashes ] (array) hashes of blocks generated\n"
|
||||||
"\nExamples:\n"
|
},
|
||||||
|
RPCExamples{
|
||||||
"\nGenerate 11 blocks to myaddress\n"
|
"\nGenerate 11 blocks to myaddress\n"
|
||||||
+ HelpExampleCli("generatetoaddress", "11 \"myaddress\"")
|
+ HelpExampleCli("generatetoaddress", "11 \"myaddress\"")
|
||||||
+ "If you are running the bitcoin core wallet, you can get a new address to send the newly generated bitcoin to with:\n"
|
+ "If you are running the bitcoin core wallet, you can get a new address to send the newly generated bitcoin to with:\n"
|
||||||
+ HelpExampleCli("getnewaddress", "")
|
+ HelpExampleCli("getnewaddress", "")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
int nGenerate = request.params[0].get_int();
|
int nGenerate = request.params[0].get_int();
|
||||||
uint64_t nMaxTries = 1000000;
|
uint64_t nMaxTries = 1000000;
|
||||||
|
@ -198,9 +200,9 @@ static UniValue getmininginfo(const JSONRPCRequest& request)
|
||||||
if (request.fHelp || request.params.size() != 0)
|
if (request.fHelp || request.params.size() != 0)
|
||||||
throw std::runtime_error(
|
throw std::runtime_error(
|
||||||
RPCHelpMan{"getmininginfo",
|
RPCHelpMan{"getmininginfo",
|
||||||
"\nReturns a json object containing mining-related information.", {}}
|
"\nReturns a json object containing mining-related information.",
|
||||||
.ToString() +
|
{},
|
||||||
"\nResult:\n"
|
RPCResult{
|
||||||
"{\n"
|
"{\n"
|
||||||
" \"blocks\": nnn, (numeric) The current block\n"
|
" \"blocks\": nnn, (numeric) The current block\n"
|
||||||
" \"currentblockweight\": nnn, (numeric) The last block weight\n"
|
" \"currentblockweight\": nnn, (numeric) The last block weight\n"
|
||||||
|
@ -211,10 +213,12 @@ static UniValue getmininginfo(const JSONRPCRequest& request)
|
||||||
" \"chain\": \"xxxx\", (string) current network name as defined in BIP70 (main, test, regtest)\n"
|
" \"chain\": \"xxxx\", (string) current network name as defined in BIP70 (main, test, regtest)\n"
|
||||||
" \"warnings\": \"...\" (string) any network and blockchain warnings\n"
|
" \"warnings\": \"...\" (string) any network and blockchain warnings\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\nExamples:\n"
|
},
|
||||||
+ HelpExampleCli("getmininginfo", "")
|
RPCExamples{
|
||||||
|
HelpExampleCli("getmininginfo", "")
|
||||||
+ HelpExampleRpc("getmininginfo", "")
|
+ HelpExampleRpc("getmininginfo", "")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
|
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
|
@ -247,14 +251,15 @@ static UniValue prioritisetransaction(const JSONRPCRequest& request)
|
||||||
" Note, that this value is not a fee rate. It is a value to modify absolute fee of the TX.\n"
|
" Note, that this value is not a fee rate. It is a value to modify absolute fee of the TX.\n"
|
||||||
" The fee is not actually paid, only the algorithm for selecting transactions into a block\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."},
|
" considers the transaction as it would have paid a higher (or lower) fee."},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResult{
|
||||||
"\nResult:\n"
|
|
||||||
"true (boolean) Returns true\n"
|
"true (boolean) Returns true\n"
|
||||||
"\nExamples:\n"
|
},
|
||||||
+ HelpExampleCli("prioritisetransaction", "\"txid\" 0.0 10000")
|
RPCExamples{
|
||||||
|
HelpExampleCli("prioritisetransaction", "\"txid\" 0.0 10000")
|
||||||
+ HelpExampleRpc("prioritisetransaction", "\"txid\", 0.0, 10000")
|
+ HelpExampleRpc("prioritisetransaction", "\"txid\", 0.0, 10000")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
|
|
||||||
|
@ -326,9 +331,8 @@ static UniValue getblocktemplate(const JSONRPCRequest& request)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"\"template_request\""},
|
"\"template_request\""},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResult{
|
||||||
"\nResult:\n"
|
|
||||||
"{\n"
|
"{\n"
|
||||||
" \"version\" : n, (numeric) The preferred block version\n"
|
" \"version\" : n, (numeric) The preferred block version\n"
|
||||||
" \"rules\" : [ \"rulename\", ... ], (array of strings) specific block rules that are to be enforced\n"
|
" \"rules\" : [ \"rulename\", ... ], (array of strings) specific block rules that are to be enforced\n"
|
||||||
|
@ -372,11 +376,12 @@ static UniValue getblocktemplate(const JSONRPCRequest& request)
|
||||||
" \"bits\" : \"xxxxxxxx\", (string) compressed target of next block\n"
|
" \"bits\" : \"xxxxxxxx\", (string) compressed target of next block\n"
|
||||||
" \"height\" : n (numeric) The height of the next block\n"
|
" \"height\" : n (numeric) The height of the next block\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
|
},
|
||||||
"\nExamples:\n"
|
RPCExamples{
|
||||||
+ HelpExampleCli("getblocktemplate", "{\"rules\": [\"segwit\"]}")
|
HelpExampleCli("getblocktemplate", "{\"rules\": [\"segwit\"]}")
|
||||||
+ HelpExampleRpc("getblocktemplate", "{\"rules\": [\"segwit\"]}")
|
+ HelpExampleRpc("getblocktemplate", "{\"rules\": [\"segwit\"]}")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
|
|
||||||
|
@ -713,13 +718,13 @@ static UniValue submitblock(const JSONRPCRequest& request)
|
||||||
{
|
{
|
||||||
{"hexdata", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "the hex-encoded block data to submit"},
|
{"hexdata", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "the hex-encoded block data to submit"},
|
||||||
{"dummy", RPCArg::Type::STR, /* opt */ true, /* default_val */ "ignored", "dummy value, for compatibility with BIP22. This value is ignored."},
|
{"dummy", RPCArg::Type::STR, /* opt */ true, /* default_val */ "ignored", "dummy value, for compatibility with BIP22. This value is ignored."},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResults{},
|
||||||
"\nResult:\n"
|
RPCExamples{
|
||||||
"\nExamples:\n"
|
HelpExampleCli("submitblock", "\"mydata\"")
|
||||||
+ HelpExampleCli("submitblock", "\"mydata\"")
|
|
||||||
+ HelpExampleRpc("submitblock", "\"mydata\"")
|
+ HelpExampleRpc("submitblock", "\"mydata\"")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<CBlock> blockptr = std::make_shared<CBlock>();
|
std::shared_ptr<CBlock> blockptr = std::make_shared<CBlock>();
|
||||||
|
@ -777,13 +782,15 @@ static UniValue submitheader(const JSONRPCRequest& request)
|
||||||
"\nThrows when the header is invalid.\n",
|
"\nThrows when the header is invalid.\n",
|
||||||
{
|
{
|
||||||
{"hexdata", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "the hex-encoded block header data"},
|
{"hexdata", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "the hex-encoded block header data"},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResult{
|
||||||
"\nResult:\n"
|
|
||||||
"None"
|
"None"
|
||||||
"\nExamples:\n" +
|
},
|
||||||
HelpExampleCli("submitheader", "\"aabbcc\"") +
|
RPCExamples{
|
||||||
HelpExampleRpc("submitheader", "\"aabbcc\""));
|
HelpExampleCli("submitheader", "\"aabbcc\"") +
|
||||||
|
HelpExampleRpc("submitheader", "\"aabbcc\"")
|
||||||
|
},
|
||||||
|
}.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
CBlockHeader h;
|
CBlockHeader h;
|
||||||
|
@ -826,9 +833,8 @@ static UniValue estimatesmartfee(const JSONRPCRequest& request)
|
||||||
" \"UNSET\"\n"
|
" \"UNSET\"\n"
|
||||||
" \"ECONOMICAL\"\n"
|
" \"ECONOMICAL\"\n"
|
||||||
" \"CONSERVATIVE\""},
|
" \"CONSERVATIVE\""},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResult{
|
||||||
"\nResult:\n"
|
|
||||||
"{\n"
|
"{\n"
|
||||||
" \"feerate\" : x.x, (numeric, optional) estimate fee rate in " + CURRENCY_UNIT + "/kB\n"
|
" \"feerate\" : x.x, (numeric, optional) estimate fee rate in " + CURRENCY_UNIT + "/kB\n"
|
||||||
" \"errors\": [ str... ] (json array of strings, optional) Errors encountered during processing\n"
|
" \"errors\": [ str... ] (json array of strings, optional) Errors encountered during processing\n"
|
||||||
|
@ -839,9 +845,11 @@ static UniValue estimatesmartfee(const JSONRPCRequest& request)
|
||||||
"fee estimation is able to return based on how long it has been running.\n"
|
"fee estimation is able to return based on how long it has been running.\n"
|
||||||
"An error is returned if not enough transactions and blocks\n"
|
"An error is returned if not enough transactions and blocks\n"
|
||||||
"have been observed to make an estimate for any number of blocks.\n"
|
"have been observed to make an estimate for any number of blocks.\n"
|
||||||
"\nExample:\n"
|
},
|
||||||
+ HelpExampleCli("estimatesmartfee", "6")
|
RPCExamples{
|
||||||
);
|
HelpExampleCli("estimatesmartfee", "6")
|
||||||
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
RPCTypeCheck(request.params, {UniValue::VNUM, UniValue::VSTR});
|
RPCTypeCheck(request.params, {UniValue::VNUM, UniValue::VSTR});
|
||||||
RPCTypeCheckArgument(request.params[0], UniValue::VNUM);
|
RPCTypeCheckArgument(request.params[0], UniValue::VNUM);
|
||||||
|
@ -886,9 +894,8 @@ static UniValue estimaterawfee(const JSONRPCRequest& request)
|
||||||
{"threshold", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "0.95", "The proportion of transactions in a given feerate range that must have been\n"
|
{"threshold", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "0.95", "The proportion of transactions in a given feerate range that must have been\n"
|
||||||
" confirmed within conf_target in order to consider those feerates as high enough and proceed to check\n"
|
" confirmed within conf_target in order to consider those feerates as high enough and proceed to check\n"
|
||||||
" lower buckets."},
|
" lower buckets."},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResult{
|
||||||
"\nResult:\n"
|
|
||||||
"{\n"
|
"{\n"
|
||||||
" \"short\" : { (json object, optional) estimate for short time horizon\n"
|
" \"short\" : { (json object, optional) estimate for short time horizon\n"
|
||||||
" \"feerate\" : x.x, (numeric, optional) estimate fee rate in " + CURRENCY_UNIT + "/kB\n"
|
" \"feerate\" : x.x, (numeric, optional) estimate fee rate in " + CURRENCY_UNIT + "/kB\n"
|
||||||
|
@ -910,9 +917,11 @@ static UniValue estimaterawfee(const JSONRPCRequest& request)
|
||||||
"}\n"
|
"}\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Results are returned for any horizon which tracks blocks up to the confirmation target.\n"
|
"Results are returned for any horizon which tracks blocks up to the confirmation target.\n"
|
||||||
"\nExample:\n"
|
},
|
||||||
+ HelpExampleCli("estimaterawfee", "6 0.9")
|
RPCExamples{
|
||||||
);
|
HelpExampleCli("estimaterawfee", "6 0.9")
|
||||||
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
RPCTypeCheck(request.params, {UniValue::VNUM, UniValue::VNUM}, true);
|
RPCTypeCheck(request.params, {UniValue::VNUM, UniValue::VNUM}, true);
|
||||||
RPCTypeCheckArgument(request.params[0], UniValue::VNUM);
|
RPCTypeCheckArgument(request.params[0], UniValue::VNUM);
|
||||||
|
|
|
@ -40,9 +40,8 @@ static UniValue validateaddress(const JSONRPCRequest& request)
|
||||||
"script, hex, pubkeys, sigsrequired, pubkey, addresses, embedded, iscompressed, account, timestamp, hdkeypath, kdmasterkeyid.\n",
|
"script, hex, pubkeys, sigsrequired, pubkey, addresses, embedded, iscompressed, account, timestamp, hdkeypath, kdmasterkeyid.\n",
|
||||||
{
|
{
|
||||||
{"address", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The bitcoin address to validate"},
|
{"address", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The bitcoin address to validate"},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResult{
|
||||||
"\nResult:\n"
|
|
||||||
"{\n"
|
"{\n"
|
||||||
" \"isvalid\" : true|false, (boolean) If the address is valid or not. If not, this is the only property returned.\n"
|
" \"isvalid\" : true|false, (boolean) If the address is valid or not. If not, this is the only property returned.\n"
|
||||||
" \"address\" : \"address\", (string) The bitcoin address validated\n"
|
" \"address\" : \"address\", (string) The bitcoin address validated\n"
|
||||||
|
@ -52,10 +51,12 @@ static UniValue validateaddress(const JSONRPCRequest& request)
|
||||||
" \"witness_version\" : version (numeric, optional) The version number of the witness program\n"
|
" \"witness_version\" : version (numeric, optional) The version number of the witness program\n"
|
||||||
" \"witness_program\" : \"hex\" (string, optional) The hex value of the witness program\n"
|
" \"witness_program\" : \"hex\" (string, optional) The hex value of the witness program\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\nExamples:\n"
|
},
|
||||||
+ HelpExampleCli("validateaddress", "\"1PSSGeFHDnKNxiEyFrD1wcEaHr9hrQDDWc\"")
|
RPCExamples{
|
||||||
|
HelpExampleCli("validateaddress", "\"1PSSGeFHDnKNxiEyFrD1wcEaHr9hrQDDWc\"")
|
||||||
+ HelpExampleRpc("validateaddress", "\"1PSSGeFHDnKNxiEyFrD1wcEaHr9hrQDDWc\"")
|
+ HelpExampleRpc("validateaddress", "\"1PSSGeFHDnKNxiEyFrD1wcEaHr9hrQDDWc\"")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
CTxDestination dest = DecodeDestination(request.params[0].get_str());
|
CTxDestination dest = DecodeDestination(request.params[0].get_str());
|
||||||
bool isValid = IsValidDestination(dest);
|
bool isValid = IsValidDestination(dest);
|
||||||
|
@ -91,20 +92,20 @@ static UniValue createmultisig(const JSONRPCRequest& request)
|
||||||
{"key", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The hex-encoded public key"},
|
{"key", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The hex-encoded public key"},
|
||||||
}},
|
}},
|
||||||
{"address_type", RPCArg::Type::STR, /* opt */ true, /* default_val */ "legacy", "The address type to use. Options are \"legacy\", \"p2sh-segwit\", and \"bech32\"."},
|
{"address_type", RPCArg::Type::STR, /* opt */ true, /* default_val */ "legacy", "The address type to use. Options are \"legacy\", \"p2sh-segwit\", and \"bech32\"."},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResult{
|
||||||
"\nResult:\n"
|
|
||||||
"{\n"
|
"{\n"
|
||||||
" \"address\":\"multisigaddress\", (string) The value of the new multisig address.\n"
|
" \"address\":\"multisigaddress\", (string) The value of the new multisig address.\n"
|
||||||
" \"redeemScript\":\"script\" (string) The string value of the hex-encoded redemption script.\n"
|
" \"redeemScript\":\"script\" (string) The string value of the hex-encoded redemption script.\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
|
},
|
||||||
"\nExamples:\n"
|
RPCExamples{
|
||||||
"\nCreate a multisig address from 2 public keys\n"
|
"\nCreate a multisig address from 2 public keys\n"
|
||||||
+ HelpExampleCli("createmultisig", "2 \"[\\\"03789ed0bb717d88f7d321a368d905e7430207ebbd82bd342cf11ae157a7ace5fd\\\",\\\"03dbc6764b8884a92e871274b87583e6d5c2a58819473e17e107ef3f6aa5a61626\\\"]\"") +
|
+ HelpExampleCli("createmultisig", "2 \"[\\\"03789ed0bb717d88f7d321a368d905e7430207ebbd82bd342cf11ae157a7ace5fd\\\",\\\"03dbc6764b8884a92e871274b87583e6d5c2a58819473e17e107ef3f6aa5a61626\\\"]\"") +
|
||||||
"\nAs a JSON-RPC call\n"
|
"\nAs a JSON-RPC call\n"
|
||||||
+ HelpExampleRpc("createmultisig", "2, \"[\\\"03789ed0bb717d88f7d321a368d905e7430207ebbd82bd342cf11ae157a7ace5fd\\\",\\\"03dbc6764b8884a92e871274b87583e6d5c2a58819473e17e107ef3f6aa5a61626\\\"]\"")
|
+ HelpExampleRpc("createmultisig", "2, \"[\\\"03789ed0bb717d88f7d321a368d905e7430207ebbd82bd342cf11ae157a7ace5fd\\\",\\\"03dbc6764b8884a92e871274b87583e6d5c2a58819473e17e107ef3f6aa5a61626\\\"]\"")
|
||||||
;
|
},
|
||||||
|
}.ToString();
|
||||||
throw std::runtime_error(msg);
|
throw std::runtime_error(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,11 +152,11 @@ static UniValue verifymessage(const JSONRPCRequest& request)
|
||||||
{"address", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The bitcoin address to use for the signature."},
|
{"address", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The bitcoin address to use for the signature."},
|
||||||
{"signature", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The signature provided by the signer in base 64 encoding (see signmessage)."},
|
{"signature", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The signature provided by the signer in base 64 encoding (see signmessage)."},
|
||||||
{"message", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The message that was signed."},
|
{"message", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The message that was signed."},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResult{
|
||||||
"\nResult:\n"
|
|
||||||
"true|false (boolean) If the signature is verified or not.\n"
|
"true|false (boolean) If the signature is verified or not.\n"
|
||||||
"\nExamples:\n"
|
},
|
||||||
|
RPCExamples{
|
||||||
"\nUnlock the wallet for 30 seconds\n"
|
"\nUnlock the wallet for 30 seconds\n"
|
||||||
+ HelpExampleCli("walletpassphrase", "\"mypassphrase\" 30") +
|
+ HelpExampleCli("walletpassphrase", "\"mypassphrase\" 30") +
|
||||||
"\nCreate the signature\n"
|
"\nCreate the signature\n"
|
||||||
|
@ -164,7 +165,8 @@ static UniValue verifymessage(const JSONRPCRequest& request)
|
||||||
+ HelpExampleCli("verifymessage", "\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\" \"signature\" \"my message\"") +
|
+ HelpExampleCli("verifymessage", "\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\" \"signature\" \"my message\"") +
|
||||||
"\nAs a JSON-RPC call\n"
|
"\nAs a JSON-RPC call\n"
|
||||||
+ HelpExampleRpc("verifymessage", "\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\", \"signature\", \"my message\"")
|
+ HelpExampleRpc("verifymessage", "\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\", \"signature\", \"my message\"")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
|
|
||||||
|
@ -208,18 +210,19 @@ static UniValue signmessagewithprivkey(const JSONRPCRequest& request)
|
||||||
{
|
{
|
||||||
{"privkey", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The private key to sign the message with."},
|
{"privkey", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The private key to sign the message with."},
|
||||||
{"message", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The message to create a signature of."},
|
{"message", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The message to create a signature of."},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResult{
|
||||||
"\nResult:\n"
|
|
||||||
"\"signature\" (string) The signature of the message encoded in base 64\n"
|
"\"signature\" (string) The signature of the message encoded in base 64\n"
|
||||||
"\nExamples:\n"
|
},
|
||||||
|
RPCExamples{
|
||||||
"\nCreate the signature\n"
|
"\nCreate the signature\n"
|
||||||
+ HelpExampleCli("signmessagewithprivkey", "\"privkey\" \"my message\"") +
|
+ HelpExampleCli("signmessagewithprivkey", "\"privkey\" \"my message\"") +
|
||||||
"\nVerify the signature\n"
|
"\nVerify the signature\n"
|
||||||
+ HelpExampleCli("verifymessage", "\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\" \"signature\" \"my message\"") +
|
+ HelpExampleCli("verifymessage", "\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\" \"signature\" \"my message\"") +
|
||||||
"\nAs a JSON-RPC call\n"
|
"\nAs a JSON-RPC call\n"
|
||||||
+ HelpExampleRpc("signmessagewithprivkey", "\"privkey\", \"my message\"")
|
+ HelpExampleRpc("signmessagewithprivkey", "\"privkey\", \"my message\"")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
std::string strPrivkey = request.params[0].get_str();
|
std::string strPrivkey = request.params[0].get_str();
|
||||||
std::string strMessage = request.params[1].get_str();
|
std::string strMessage = request.params[1].get_str();
|
||||||
|
@ -249,8 +252,10 @@ static UniValue setmocktime(const JSONRPCRequest& request)
|
||||||
{
|
{
|
||||||
{"timestamp", RPCArg::Type::NUM, /* opt */ false, /* default_val */ "", "Unix seconds-since-epoch timestamp\n"
|
{"timestamp", RPCArg::Type::NUM, /* opt */ false, /* default_val */ "", "Unix seconds-since-epoch timestamp\n"
|
||||||
" Pass 0 to go back to using the system time."},
|
" Pass 0 to go back to using the system time."},
|
||||||
}}
|
},
|
||||||
.ToString()
|
RPCResults{},
|
||||||
|
RPCExamples{""},
|
||||||
|
}.ToString()
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!Params().MineBlocksOnDemand())
|
if (!Params().MineBlocksOnDemand())
|
||||||
|
@ -314,9 +319,9 @@ static UniValue getmemoryinfo(const JSONRPCRequest& request)
|
||||||
{"mode", RPCArg::Type::STR, /* opt */ true, /* default_val */ "\"stats\"", "determines what kind of information is returned.\n"
|
{"mode", RPCArg::Type::STR, /* opt */ true, /* default_val */ "\"stats\"", "determines what kind of information is returned.\n"
|
||||||
" - \"stats\" returns general statistics about memory usage in the daemon.\n"
|
" - \"stats\" returns general statistics about memory usage in the daemon.\n"
|
||||||
" - \"mallocinfo\" returns an XML string describing low-level heap state (only available if compiled with glibc 2.10+)."},
|
" - \"mallocinfo\" returns an XML string describing low-level heap state (only available if compiled with glibc 2.10+)."},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
{
|
||||||
"\nResult (mode \"stats\"):\n"
|
RPCResult{"mode \"stats\"",
|
||||||
"{\n"
|
"{\n"
|
||||||
" \"locked\": { (json object) Information about locked memory manager\n"
|
" \"locked\": { (json object) Information about locked memory manager\n"
|
||||||
" \"used\": xxxxx, (numeric) Number of bytes used\n"
|
" \"used\": xxxxx, (numeric) Number of bytes used\n"
|
||||||
|
@ -327,12 +332,16 @@ static UniValue getmemoryinfo(const JSONRPCRequest& request)
|
||||||
" \"chunks_free\": xxxxx, (numeric) Number unused chunks\n"
|
" \"chunks_free\": xxxxx, (numeric) Number unused chunks\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\nResult (mode \"mallocinfo\"):\n"
|
},
|
||||||
|
RPCResult{"mode \"mallocinfo\"",
|
||||||
"\"<malloc version=\"1\">...\"\n"
|
"\"<malloc version=\"1\">...\"\n"
|
||||||
"\nExamples:\n"
|
},
|
||||||
+ HelpExampleCli("getmemoryinfo", "")
|
},
|
||||||
|
RPCExamples{
|
||||||
|
HelpExampleCli("getmemoryinfo", "")
|
||||||
+ HelpExampleRpc("getmemoryinfo", "")
|
+ HelpExampleRpc("getmemoryinfo", "")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
std::string mode = request.params[0].isNull() ? "stats" : request.params[0].get_str();
|
std::string mode = request.params[0].isNull() ? "stats" : request.params[0].get_str();
|
||||||
if (mode == "stats") {
|
if (mode == "stats") {
|
||||||
|
@ -392,17 +401,18 @@ UniValue logging(const JSONRPCRequest& request)
|
||||||
{
|
{
|
||||||
{"exclude_category", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "the valid logging category"},
|
{"exclude_category", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "the valid logging category"},
|
||||||
}},
|
}},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResult{
|
||||||
"\nResult:\n"
|
|
||||||
"{ (json object where keys are the logging categories, and values indicates its status\n"
|
"{ (json object where keys are the logging categories, and values indicates its status\n"
|
||||||
" \"category\": 0|1, (numeric) if being debug logged or not. 0:inactive, 1:active\n"
|
" \"category\": 0|1, (numeric) if being debug logged or not. 0:inactive, 1:active\n"
|
||||||
" ...\n"
|
" ...\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\nExamples:\n"
|
},
|
||||||
+ HelpExampleCli("logging", "\"[\\\"all\\\"]\" \"[\\\"http\\\"]\"")
|
RPCExamples{
|
||||||
|
HelpExampleCli("logging", "\"[\\\"all\\\"]\" \"[\\\"http\\\"]\"")
|
||||||
+ HelpExampleRpc("logging", "[\"all\"], \"[libevent]\"")
|
+ HelpExampleRpc("logging", "[\"all\"], \"[libevent]\"")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t original_log_categories = g_logger->GetCategoryMask();
|
uint32_t original_log_categories = g_logger->GetCategoryMask();
|
||||||
|
@ -446,9 +456,11 @@ static UniValue echo(const JSONRPCRequest& request)
|
||||||
"\nSimply echo back the input arguments. This command is for testing.\n"
|
"\nSimply echo back the input arguments. This command is for testing.\n"
|
||||||
"\nThe difference between echo and echojson is that echojson has argument conversion enabled in the client-side table in "
|
"\nThe difference between echo and echojson is that echojson has argument conversion enabled in the client-side table in "
|
||||||
"bitcoin-cli and the GUI. There is no server-side difference.",
|
"bitcoin-cli and the GUI. There is no server-side difference.",
|
||||||
{}}
|
{},
|
||||||
.ToString() +
|
RPCResults{},
|
||||||
"");
|
RPCExamples{""},
|
||||||
|
}.ToString()
|
||||||
|
);
|
||||||
|
|
||||||
return request.params;
|
return request.params;
|
||||||
}
|
}
|
||||||
|
|
155
src/rpc/net.cpp
155
src/rpc/net.cpp
|
@ -30,14 +30,16 @@ static UniValue getconnectioncount(const JSONRPCRequest& request)
|
||||||
if (request.fHelp || request.params.size() != 0)
|
if (request.fHelp || request.params.size() != 0)
|
||||||
throw std::runtime_error(
|
throw std::runtime_error(
|
||||||
RPCHelpMan{"getconnectioncount",
|
RPCHelpMan{"getconnectioncount",
|
||||||
"\nReturns the number of connections to other nodes.\n", {}}
|
"\nReturns the number of connections to other nodes.\n",
|
||||||
.ToString() +
|
{},
|
||||||
"\nResult:\n"
|
RPCResult{
|
||||||
"n (numeric) The connection count\n"
|
"n (numeric) The connection count\n"
|
||||||
"\nExamples:\n"
|
},
|
||||||
+ HelpExampleCli("getconnectioncount", "")
|
RPCExamples{
|
||||||
|
HelpExampleCli("getconnectioncount", "")
|
||||||
+ HelpExampleRpc("getconnectioncount", "")
|
+ HelpExampleRpc("getconnectioncount", "")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
if(!g_connman)
|
if(!g_connman)
|
||||||
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
|
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
|
||||||
|
@ -53,12 +55,13 @@ static UniValue ping(const JSONRPCRequest& request)
|
||||||
"\nRequests that a ping be sent to all other nodes, to measure ping time.\n"
|
"\nRequests that a ping be sent to all other nodes, to measure ping time.\n"
|
||||||
"Results provided in getpeerinfo, pingtime and pingwait fields are decimal seconds.\n"
|
"Results provided in getpeerinfo, pingtime and pingwait fields are decimal seconds.\n"
|
||||||
"Ping command is handled in queue with all other commands, so it measures processing backlog, not just network ping.\n",
|
"Ping command is handled in queue with all other commands, so it measures processing backlog, not just network ping.\n",
|
||||||
{}}
|
{},
|
||||||
.ToString() +
|
RPCResults{},
|
||||||
"\nExamples:\n"
|
RPCExamples{
|
||||||
+ HelpExampleCli("ping", "")
|
HelpExampleCli("ping", "")
|
||||||
+ HelpExampleRpc("ping", "")
|
+ HelpExampleRpc("ping", "")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
if(!g_connman)
|
if(!g_connman)
|
||||||
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
|
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
|
||||||
|
@ -75,9 +78,9 @@ static UniValue getpeerinfo(const JSONRPCRequest& request)
|
||||||
if (request.fHelp || request.params.size() != 0)
|
if (request.fHelp || request.params.size() != 0)
|
||||||
throw std::runtime_error(
|
throw std::runtime_error(
|
||||||
RPCHelpMan{"getpeerinfo",
|
RPCHelpMan{"getpeerinfo",
|
||||||
"\nReturns data about each connected network node as a json array of objects.\n", {}}
|
"\nReturns data about each connected network node as a json array of objects.\n",
|
||||||
.ToString() +
|
{},
|
||||||
"\nResult:\n"
|
RPCResult{
|
||||||
"[\n"
|
"[\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
" \"id\": n, (numeric) Peer index\n"
|
" \"id\": n, (numeric) Peer index\n"
|
||||||
|
@ -124,10 +127,12 @@ static UniValue getpeerinfo(const JSONRPCRequest& request)
|
||||||
" }\n"
|
" }\n"
|
||||||
" ,...\n"
|
" ,...\n"
|
||||||
"]\n"
|
"]\n"
|
||||||
"\nExamples:\n"
|
},
|
||||||
+ HelpExampleCli("getpeerinfo", "")
|
RPCExamples{
|
||||||
|
HelpExampleCli("getpeerinfo", "")
|
||||||
+ HelpExampleRpc("getpeerinfo", "")
|
+ HelpExampleRpc("getpeerinfo", "")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
if(!g_connman)
|
if(!g_connman)
|
||||||
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
|
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
|
||||||
|
@ -218,12 +223,13 @@ static UniValue addnode(const JSONRPCRequest& request)
|
||||||
{
|
{
|
||||||
{"node", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The node (see getpeerinfo for nodes)"},
|
{"node", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The node (see getpeerinfo for nodes)"},
|
||||||
{"command", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "'add' to add a node to the list, 'remove' to remove a node from the list, 'onetry' to try a connection to the node once"},
|
{"command", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "'add' to add a node to the list, 'remove' to remove a node from the list, 'onetry' to try a connection to the node once"},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResults{},
|
||||||
"\nExamples:\n"
|
RPCExamples{
|
||||||
+ HelpExampleCli("addnode", "\"192.168.0.6:8333\" \"onetry\"")
|
HelpExampleCli("addnode", "\"192.168.0.6:8333\" \"onetry\"")
|
||||||
+ HelpExampleRpc("addnode", "\"192.168.0.6:8333\", \"onetry\"")
|
+ HelpExampleRpc("addnode", "\"192.168.0.6:8333\", \"onetry\"")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
if(!g_connman)
|
if(!g_connman)
|
||||||
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
|
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
|
||||||
|
@ -262,14 +268,15 @@ static UniValue disconnectnode(const JSONRPCRequest& request)
|
||||||
{
|
{
|
||||||
{"address", RPCArg::Type::STR, /* opt */ true, /* default_val */ "fallback to nodeid", "The IP address/port of the node"},
|
{"address", RPCArg::Type::STR, /* opt */ true, /* default_val */ "fallback to nodeid", "The IP address/port of the node"},
|
||||||
{"nodeid", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "fallback to address", "The node ID (see getpeerinfo for node IDs)"},
|
{"nodeid", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "fallback to address", "The node ID (see getpeerinfo for node IDs)"},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResults{},
|
||||||
"\nExamples:\n"
|
RPCExamples{
|
||||||
+ HelpExampleCli("disconnectnode", "\"192.168.0.6:8333\"")
|
HelpExampleCli("disconnectnode", "\"192.168.0.6:8333\"")
|
||||||
+ HelpExampleCli("disconnectnode", "\"\" 1")
|
+ HelpExampleCli("disconnectnode", "\"\" 1")
|
||||||
+ HelpExampleRpc("disconnectnode", "\"192.168.0.6:8333\"")
|
+ HelpExampleRpc("disconnectnode", "\"192.168.0.6:8333\"")
|
||||||
+ HelpExampleRpc("disconnectnode", "\"\", 1")
|
+ HelpExampleRpc("disconnectnode", "\"\", 1")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
if(!g_connman)
|
if(!g_connman)
|
||||||
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
|
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
|
||||||
|
@ -305,9 +312,8 @@ static UniValue getaddednodeinfo(const JSONRPCRequest& request)
|
||||||
"(note that onetry addnodes are not listed here)\n",
|
"(note that onetry addnodes are not listed here)\n",
|
||||||
{
|
{
|
||||||
{"node", RPCArg::Type::STR, /* opt */ true, /* default_val */ "all nodes", "If provided, return information about this specific node, otherwise all nodes are returned."},
|
{"node", RPCArg::Type::STR, /* opt */ true, /* default_val */ "all nodes", "If provided, return information about this specific node, otherwise all nodes are returned."},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResult{
|
||||||
"\nResult:\n"
|
|
||||||
"[\n"
|
"[\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
" \"addednode\" : \"192.168.0.201\", (string) The node IP address or name (as provided to addnode)\n"
|
" \"addednode\" : \"192.168.0.201\", (string) The node IP address or name (as provided to addnode)\n"
|
||||||
|
@ -321,10 +327,12 @@ static UniValue getaddednodeinfo(const JSONRPCRequest& request)
|
||||||
" }\n"
|
" }\n"
|
||||||
" ,...\n"
|
" ,...\n"
|
||||||
"]\n"
|
"]\n"
|
||||||
"\nExamples:\n"
|
},
|
||||||
+ HelpExampleCli("getaddednodeinfo", "\"192.168.0.201\"")
|
RPCExamples{
|
||||||
|
HelpExampleCli("getaddednodeinfo", "\"192.168.0.201\"")
|
||||||
+ HelpExampleRpc("getaddednodeinfo", "\"192.168.0.201\"")
|
+ HelpExampleRpc("getaddednodeinfo", "\"192.168.0.201\"")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
if(!g_connman)
|
if(!g_connman)
|
||||||
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
|
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
|
||||||
|
@ -372,9 +380,8 @@ static UniValue getnettotals(const JSONRPCRequest& request)
|
||||||
RPCHelpMan{"getnettotals",
|
RPCHelpMan{"getnettotals",
|
||||||
"\nReturns information about network traffic, including bytes in, bytes out,\n"
|
"\nReturns information about network traffic, including bytes in, bytes out,\n"
|
||||||
"and current time.\n",
|
"and current time.\n",
|
||||||
{}}
|
{},
|
||||||
.ToString() +
|
RPCResult{
|
||||||
"\nResult:\n"
|
|
||||||
"{\n"
|
"{\n"
|
||||||
" \"totalbytesrecv\": n, (numeric) Total bytes received\n"
|
" \"totalbytesrecv\": n, (numeric) Total bytes received\n"
|
||||||
" \"totalbytessent\": n, (numeric) Total bytes sent\n"
|
" \"totalbytessent\": n, (numeric) Total bytes sent\n"
|
||||||
|
@ -389,10 +396,12 @@ static UniValue getnettotals(const JSONRPCRequest& request)
|
||||||
" \"time_left_in_cycle\": t (numeric) Seconds left in current time cycle\n"
|
" \"time_left_in_cycle\": t (numeric) Seconds left in current time cycle\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\nExamples:\n"
|
},
|
||||||
+ HelpExampleCli("getnettotals", "")
|
RPCExamples{
|
||||||
|
HelpExampleCli("getnettotals", "")
|
||||||
+ HelpExampleRpc("getnettotals", "")
|
+ HelpExampleRpc("getnettotals", "")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
if(!g_connman)
|
if(!g_connman)
|
||||||
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
|
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
|
||||||
|
|
||||||
|
@ -438,9 +447,9 @@ static UniValue getnetworkinfo(const JSONRPCRequest& request)
|
||||||
if (request.fHelp || request.params.size() != 0)
|
if (request.fHelp || request.params.size() != 0)
|
||||||
throw std::runtime_error(
|
throw std::runtime_error(
|
||||||
RPCHelpMan{"getnetworkinfo",
|
RPCHelpMan{"getnetworkinfo",
|
||||||
"Returns an object containing various state info regarding P2P networking.\n", {}}
|
"Returns an object containing various state info regarding P2P networking.\n",
|
||||||
.ToString() +
|
{},
|
||||||
"\nResult:\n"
|
RPCResult{
|
||||||
"{\n"
|
"{\n"
|
||||||
" \"version\": xxxxx, (numeric) the server version\n"
|
" \"version\": xxxxx, (numeric) the server version\n"
|
||||||
" \"subversion\": \"/Satoshi:x.x.x/\", (string) the server subversion string\n"
|
" \"subversion\": \"/Satoshi:x.x.x/\", (string) the server subversion string\n"
|
||||||
|
@ -472,10 +481,12 @@ static UniValue getnetworkinfo(const JSONRPCRequest& request)
|
||||||
" ]\n"
|
" ]\n"
|
||||||
" \"warnings\": \"...\" (string) any network and blockchain warnings\n"
|
" \"warnings\": \"...\" (string) any network and blockchain warnings\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\nExamples:\n"
|
},
|
||||||
+ HelpExampleCli("getnetworkinfo", "")
|
RPCExamples{
|
||||||
|
HelpExampleCli("getnetworkinfo", "")
|
||||||
+ HelpExampleRpc("getnetworkinfo", "")
|
+ HelpExampleRpc("getnetworkinfo", "")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
UniValue obj(UniValue::VOBJ);
|
UniValue obj(UniValue::VOBJ);
|
||||||
|
@ -525,13 +536,14 @@ static UniValue setban(const JSONRPCRequest& request)
|
||||||
{"command", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "'add' to add an IP/Subnet to the list, 'remove' to remove an IP/Subnet from the list"},
|
{"command", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "'add' to add an IP/Subnet to the list, 'remove' to remove an IP/Subnet from the list"},
|
||||||
{"bantime", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "0", "time in seconds how long (or until when if [absolute] is set) the IP is banned (0 or empty means using the default time of 24h which can also be overwritten by the -bantime startup argument)"},
|
{"bantime", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "0", "time in seconds how long (or until when if [absolute] is set) the IP is banned (0 or empty means using the default time of 24h which can also be overwritten by the -bantime startup argument)"},
|
||||||
{"absolute", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "If set, the bantime must be an absolute timestamp in seconds since epoch (Jan 1 1970 GMT)"},
|
{"absolute", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "If set, the bantime must be an absolute timestamp in seconds since epoch (Jan 1 1970 GMT)"},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResults{},
|
||||||
"\nExamples:\n"
|
RPCExamples{
|
||||||
+ HelpExampleCli("setban", "\"192.168.0.6\" \"add\" 86400")
|
HelpExampleCli("setban", "\"192.168.0.6\" \"add\" 86400")
|
||||||
+ HelpExampleCli("setban", "\"192.168.0.0/24\" \"add\"")
|
+ HelpExampleCli("setban", "\"192.168.0.0/24\" \"add\"")
|
||||||
+ HelpExampleRpc("setban", "\"192.168.0.6\", \"add\", 86400")
|
+ HelpExampleRpc("setban", "\"192.168.0.6\", \"add\", 86400")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
if (!g_banman) {
|
if (!g_banman) {
|
||||||
throw JSONRPCError(RPC_DATABASE_ERROR, "Error: Ban database not loaded");
|
throw JSONRPCError(RPC_DATABASE_ERROR, "Error: Ban database not loaded");
|
||||||
}
|
}
|
||||||
|
@ -594,12 +606,14 @@ static UniValue listbanned(const JSONRPCRequest& request)
|
||||||
if (request.fHelp || request.params.size() != 0)
|
if (request.fHelp || request.params.size() != 0)
|
||||||
throw std::runtime_error(
|
throw std::runtime_error(
|
||||||
RPCHelpMan{"listbanned",
|
RPCHelpMan{"listbanned",
|
||||||
"\nList all banned IPs/Subnets.\n", {}}
|
"\nList all banned IPs/Subnets.\n",
|
||||||
.ToString() +
|
{},
|
||||||
"\nExamples:\n"
|
RPCResults{},
|
||||||
+ HelpExampleCli("listbanned", "")
|
RPCExamples{
|
||||||
|
HelpExampleCli("listbanned", "")
|
||||||
+ HelpExampleRpc("listbanned", "")
|
+ HelpExampleRpc("listbanned", "")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
if(!g_banman) {
|
if(!g_banman) {
|
||||||
throw JSONRPCError(RPC_DATABASE_ERROR, "Error: Ban database not loaded");
|
throw JSONRPCError(RPC_DATABASE_ERROR, "Error: Ban database not loaded");
|
||||||
|
@ -629,12 +643,14 @@ static UniValue clearbanned(const JSONRPCRequest& request)
|
||||||
if (request.fHelp || request.params.size() != 0)
|
if (request.fHelp || request.params.size() != 0)
|
||||||
throw std::runtime_error(
|
throw std::runtime_error(
|
||||||
RPCHelpMan{"clearbanned",
|
RPCHelpMan{"clearbanned",
|
||||||
"\nClear all banned IPs.\n", {}}
|
"\nClear all banned IPs.\n",
|
||||||
.ToString() +
|
{},
|
||||||
"\nExamples:\n"
|
RPCResults{},
|
||||||
+ HelpExampleCli("clearbanned", "")
|
RPCExamples{
|
||||||
|
HelpExampleCli("clearbanned", "")
|
||||||
+ HelpExampleRpc("clearbanned", "")
|
+ HelpExampleRpc("clearbanned", "")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
if (!g_banman) {
|
if (!g_banman) {
|
||||||
throw JSONRPCError(RPC_DATABASE_ERROR, "Error: Ban database not loaded");
|
throw JSONRPCError(RPC_DATABASE_ERROR, "Error: Ban database not loaded");
|
||||||
}
|
}
|
||||||
|
@ -652,8 +668,10 @@ static UniValue setnetworkactive(const JSONRPCRequest& request)
|
||||||
"\nDisable/enable all p2p network activity.\n",
|
"\nDisable/enable all p2p network activity.\n",
|
||||||
{
|
{
|
||||||
{"state", RPCArg::Type::BOOL, /* opt */ false, /* default_val */ "", "true to enable networking, false to disable"},
|
{"state", RPCArg::Type::BOOL, /* opt */ false, /* default_val */ "", "true to enable networking, false to disable"},
|
||||||
}}
|
},
|
||||||
.ToString()
|
RPCResults{},
|
||||||
|
RPCExamples{""},
|
||||||
|
}.ToString()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -674,9 +692,8 @@ static UniValue getnodeaddresses(const JSONRPCRequest& request)
|
||||||
"\nReturn known addresses which can potentially be used to find new nodes in the network\n",
|
"\nReturn known addresses which can potentially be used to find new nodes in the network\n",
|
||||||
{
|
{
|
||||||
{"count", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "1", "How many addresses to return. Limited to the smaller of " + std::to_string(ADDRMAN_GETADDR_MAX) + " or " + std::to_string(ADDRMAN_GETADDR_MAX_PCT) + "% of all known addresses."},
|
{"count", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "1", "How many addresses to return. Limited to the smaller of " + std::to_string(ADDRMAN_GETADDR_MAX) + " or " + std::to_string(ADDRMAN_GETADDR_MAX_PCT) + "% of all known addresses."},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResult{
|
||||||
"\nResult:\n"
|
|
||||||
"[\n"
|
"[\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
" \"time\": ttt, (numeric) Timestamp in seconds since epoch (Jan 1 1970 GMT) keeping track of when the node was last seen\n"
|
" \"time\": ttt, (numeric) Timestamp in seconds since epoch (Jan 1 1970 GMT) keeping track of when the node was last seen\n"
|
||||||
|
@ -686,10 +703,12 @@ static UniValue getnodeaddresses(const JSONRPCRequest& request)
|
||||||
" }\n"
|
" }\n"
|
||||||
" ,....\n"
|
" ,....\n"
|
||||||
"]\n"
|
"]\n"
|
||||||
"\nExamples:\n"
|
},
|
||||||
+ HelpExampleCli("getnodeaddresses", "8")
|
RPCExamples{
|
||||||
|
HelpExampleCli("getnodeaddresses", "8")
|
||||||
+ HelpExampleRpc("getnodeaddresses", "8")
|
+ HelpExampleRpc("getnodeaddresses", "8")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
}
|
}
|
||||||
if (!g_connman) {
|
if (!g_connman) {
|
||||||
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
|
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
|
||||||
|
|
|
@ -82,12 +82,12 @@ static UniValue getrawtransaction(const JSONRPCRequest& request)
|
||||||
{"txid", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The transaction id"},
|
{"txid", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The transaction id"},
|
||||||
{"verbose", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "If false, return a string, otherwise return a json object"},
|
{"verbose", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "If false, return a string, otherwise return a json object"},
|
||||||
{"blockhash", RPCArg::Type::STR_HEX, /* opt */ true, /* default_val */ "null", "The block in which to look for the transaction"},
|
{"blockhash", RPCArg::Type::STR_HEX, /* opt */ true, /* default_val */ "null", "The block in which to look for the transaction"},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
{
|
||||||
"\nResult (if verbose is not set or set to false):\n"
|
RPCResult{"if verbose is not set or set to false",
|
||||||
"\"data\" (string) The serialized, hex-encoded data for 'txid'\n"
|
"\"data\" (string) The serialized, hex-encoded data for 'txid'\n"
|
||||||
|
},
|
||||||
"\nResult (if verbose is set to true):\n"
|
RPCResult{"if verbose is set to true",
|
||||||
"{\n"
|
"{\n"
|
||||||
" \"in_active_chain\": b, (bool) Whether specified block is in the active chain or not (only present with explicit \"blockhash\" argument)\n"
|
" \"in_active_chain\": b, (bool) Whether specified block is in the active chain or not (only present with explicit \"blockhash\" argument)\n"
|
||||||
" \"hex\" : \"data\", (string) The serialized, hex-encoded data for 'txid'\n"
|
" \"hex\" : \"data\", (string) The serialized, hex-encoded data for 'txid'\n"
|
||||||
|
@ -133,14 +133,16 @@ static UniValue getrawtransaction(const JSONRPCRequest& request)
|
||||||
" \"blocktime\" : ttt (numeric) The block time in seconds since epoch (Jan 1 1970 GMT)\n"
|
" \"blocktime\" : ttt (numeric) The block time in seconds since epoch (Jan 1 1970 GMT)\n"
|
||||||
" \"time\" : ttt, (numeric) Same as \"blocktime\"\n"
|
" \"time\" : ttt, (numeric) Same as \"blocktime\"\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
|
},
|
||||||
"\nExamples:\n"
|
},
|
||||||
+ HelpExampleCli("getrawtransaction", "\"mytxid\"")
|
RPCExamples{
|
||||||
|
HelpExampleCli("getrawtransaction", "\"mytxid\"")
|
||||||
+ HelpExampleCli("getrawtransaction", "\"mytxid\" true")
|
+ HelpExampleCli("getrawtransaction", "\"mytxid\" true")
|
||||||
+ HelpExampleRpc("getrawtransaction", "\"mytxid\", true")
|
+ HelpExampleRpc("getrawtransaction", "\"mytxid\", true")
|
||||||
+ HelpExampleCli("getrawtransaction", "\"mytxid\" false \"myblockhash\"")
|
+ HelpExampleCli("getrawtransaction", "\"mytxid\" false \"myblockhash\"")
|
||||||
+ HelpExampleCli("getrawtransaction", "\"mytxid\" true \"myblockhash\"")
|
+ HelpExampleCli("getrawtransaction", "\"mytxid\" true \"myblockhash\"")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
bool in_active_chain = true;
|
bool in_active_chain = true;
|
||||||
uint256 hash = ParseHashV(request.params[0], "parameter 1");
|
uint256 hash = ParseHashV(request.params[0], "parameter 1");
|
||||||
|
@ -219,10 +221,12 @@ static UniValue gettxoutproof(const JSONRPCRequest& request)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{"blockhash", RPCArg::Type::STR_HEX, /* opt */ true, /* default_val */ "null", "If specified, looks for txid in the block with this hash"},
|
{"blockhash", RPCArg::Type::STR_HEX, /* opt */ true, /* default_val */ "null", "If specified, looks for txid in the block with this hash"},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResult{
|
||||||
"\nResult:\n"
|
|
||||||
"\"data\" (string) A string that is a serialized, hex-encoded data for the proof.\n"
|
"\"data\" (string) A string that is a serialized, hex-encoded data for the proof.\n"
|
||||||
|
},
|
||||||
|
RPCExamples{""},
|
||||||
|
}.ToString()
|
||||||
);
|
);
|
||||||
|
|
||||||
std::set<uint256> setTxids;
|
std::set<uint256> setTxids;
|
||||||
|
@ -305,10 +309,12 @@ static UniValue verifytxoutproof(const JSONRPCRequest& request)
|
||||||
"and throwing an RPC error if the block is not in our best chain\n",
|
"and throwing an RPC error if the block is not in our best chain\n",
|
||||||
{
|
{
|
||||||
{"proof", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The hex-encoded proof generated by gettxoutproof"},
|
{"proof", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The hex-encoded proof generated by gettxoutproof"},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResult{
|
||||||
"\nResult:\n"
|
|
||||||
"[\"txid\"] (array, strings) The txid(s) which the proof commits to, or empty array if the proof can not be validated.\n"
|
"[\"txid\"] (array, strings) The txid(s) which the proof commits to, or empty array if the proof can not be validated.\n"
|
||||||
|
},
|
||||||
|
RPCExamples{""},
|
||||||
|
}.ToString()
|
||||||
);
|
);
|
||||||
|
|
||||||
CDataStream ssMB(ParseHexV(request.params[0], "proof"), SER_NETWORK, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS);
|
CDataStream ssMB(ParseHexV(request.params[0], "proof"), SER_NETWORK, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS);
|
||||||
|
@ -494,17 +500,17 @@ static UniValue createrawtransaction(const JSONRPCRequest& request)
|
||||||
{"locktime", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "0", "Raw locktime. Non-0 value also locktime-activates inputs"},
|
{"locktime", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "0", "Raw locktime. Non-0 value also locktime-activates inputs"},
|
||||||
{"replaceable", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "Marks this transaction as BIP125-replaceable.\n"
|
{"replaceable", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "Marks this transaction as BIP125-replaceable.\n"
|
||||||
" Allows this transaction to be replaced by a transaction with higher fees. If provided, it is an error if explicit sequence numbers are incompatible."},
|
" Allows this transaction to be replaced by a transaction with higher fees. If provided, it is an error if explicit sequence numbers are incompatible."},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResult{
|
||||||
"\nResult:\n"
|
|
||||||
"\"transaction\" (string) hex string of the transaction\n"
|
"\"transaction\" (string) hex string of the transaction\n"
|
||||||
|
},
|
||||||
"\nExamples:\n"
|
RPCExamples{
|
||||||
+ HelpExampleCli("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" \"[{\\\"address\\\":0.01}]\"")
|
HelpExampleCli("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" \"[{\\\"address\\\":0.01}]\"")
|
||||||
+ HelpExampleCli("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" \"[{\\\"data\\\":\\\"00010203\\\"}]\"")
|
+ HelpExampleCli("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" \"[{\\\"data\\\":\\\"00010203\\\"}]\"")
|
||||||
+ HelpExampleRpc("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\", \"[{\\\"address\\\":0.01}]\"")
|
+ HelpExampleRpc("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\", \"[{\\\"address\\\":0.01}]\"")
|
||||||
+ HelpExampleRpc("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\", \"[{\\\"data\\\":\\\"00010203\\\"}]\"")
|
+ HelpExampleRpc("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\", \"[{\\\"data\\\":\\\"00010203\\\"}]\"")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
RPCTypeCheck(request.params, {
|
RPCTypeCheck(request.params, {
|
||||||
|
@ -530,9 +536,8 @@ static UniValue decoderawtransaction(const JSONRPCRequest& request)
|
||||||
{"hexstring", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The transaction hex string"},
|
{"hexstring", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The transaction hex string"},
|
||||||
{"iswitness", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "depends on heuristic tests", "Whether the transaction hex is a serialized witness transaction\n"
|
{"iswitness", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "depends on heuristic tests", "Whether the transaction hex is a serialized witness transaction\n"
|
||||||
" If iswitness is not present, heuristic tests will be used in decoding"},
|
" If iswitness is not present, heuristic tests will be used in decoding"},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResult{
|
||||||
"\nResult:\n"
|
|
||||||
"{\n"
|
"{\n"
|
||||||
" \"txid\" : \"id\", (string) The transaction id\n"
|
" \"txid\" : \"id\", (string) The transaction id\n"
|
||||||
" \"hash\" : \"id\", (string) The transaction hash (differs from txid for witness transactions)\n"
|
" \"hash\" : \"id\", (string) The transaction hash (differs from txid for witness transactions)\n"
|
||||||
|
@ -572,11 +577,12 @@ static UniValue decoderawtransaction(const JSONRPCRequest& request)
|
||||||
" ,...\n"
|
" ,...\n"
|
||||||
" ],\n"
|
" ],\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
|
},
|
||||||
"\nExamples:\n"
|
RPCExamples{
|
||||||
+ HelpExampleCli("decoderawtransaction", "\"hexstring\"")
|
HelpExampleCli("decoderawtransaction", "\"hexstring\"")
|
||||||
+ HelpExampleRpc("decoderawtransaction", "\"hexstring\"")
|
+ HelpExampleRpc("decoderawtransaction", "\"hexstring\"")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
RPCTypeCheck(request.params, {UniValue::VSTR, UniValue::VBOOL});
|
RPCTypeCheck(request.params, {UniValue::VSTR, UniValue::VBOOL});
|
||||||
|
|
||||||
|
@ -603,9 +609,8 @@ static UniValue decodescript(const JSONRPCRequest& request)
|
||||||
"\nDecode a hex-encoded script.\n",
|
"\nDecode a hex-encoded script.\n",
|
||||||
{
|
{
|
||||||
{"hexstring", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "the hex-encoded script"},
|
{"hexstring", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "the hex-encoded script"},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResult{
|
||||||
"\nResult:\n"
|
|
||||||
"{\n"
|
"{\n"
|
||||||
" \"asm\":\"asm\", (string) Script public key\n"
|
" \"asm\":\"asm\", (string) Script public key\n"
|
||||||
" \"hex\":\"hex\", (string) hex-encoded public key\n"
|
" \"hex\":\"hex\", (string) hex-encoded public key\n"
|
||||||
|
@ -617,10 +622,12 @@ static UniValue decodescript(const JSONRPCRequest& request)
|
||||||
" ],\n"
|
" ],\n"
|
||||||
" \"p2sh\",\"address\" (string) address of P2SH script wrapping this redeem script (not returned if the script is already a P2SH).\n"
|
" \"p2sh\",\"address\" (string) address of P2SH script wrapping this redeem script (not returned if the script is already a P2SH).\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\nExamples:\n"
|
},
|
||||||
+ HelpExampleCli("decodescript", "\"hexstring\"")
|
RPCExamples{
|
||||||
|
HelpExampleCli("decodescript", "\"hexstring\"")
|
||||||
+ HelpExampleRpc("decodescript", "\"hexstring\"")
|
+ HelpExampleRpc("decodescript", "\"hexstring\"")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
RPCTypeCheck(request.params, {UniValue::VSTR});
|
RPCTypeCheck(request.params, {UniValue::VSTR});
|
||||||
|
|
||||||
|
@ -706,14 +713,14 @@ static UniValue combinerawtransaction(const JSONRPCRequest& request)
|
||||||
{"hexstring", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "A transaction hash"},
|
{"hexstring", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "A transaction hash"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResult{
|
||||||
"\nResult:\n"
|
|
||||||
"\"hex\" (string) The hex-encoded raw transaction with signature(s)\n"
|
"\"hex\" (string) The hex-encoded raw transaction with signature(s)\n"
|
||||||
|
},
|
||||||
"\nExamples:\n"
|
RPCExamples{
|
||||||
+ HelpExampleCli("combinerawtransaction", "[\"myhex1\", \"myhex2\", \"myhex3\"]")
|
HelpExampleCli("combinerawtransaction", "[\"myhex1\", \"myhex2\", \"myhex3\"]")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
|
|
||||||
UniValue txs = request.params[0].get_array();
|
UniValue txs = request.params[0].get_array();
|
||||||
|
@ -953,9 +960,8 @@ static UniValue signrawtransactionwithkey(const JSONRPCRequest& request)
|
||||||
" \"NONE|ANYONECANPAY\"\n"
|
" \"NONE|ANYONECANPAY\"\n"
|
||||||
" \"SINGLE|ANYONECANPAY\"\n"
|
" \"SINGLE|ANYONECANPAY\"\n"
|
||||||
},
|
},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResult{
|
||||||
"\nResult:\n"
|
|
||||||
"{\n"
|
"{\n"
|
||||||
" \"hex\" : \"value\", (string) The hex-encoded raw transaction with signature(s)\n"
|
" \"hex\" : \"value\", (string) The hex-encoded raw transaction with signature(s)\n"
|
||||||
" \"complete\" : true|false, (boolean) If the transaction has a complete set of signatures\n"
|
" \"complete\" : true|false, (boolean) If the transaction has a complete set of signatures\n"
|
||||||
|
@ -970,11 +976,12 @@ static UniValue signrawtransactionwithkey(const JSONRPCRequest& request)
|
||||||
" ,...\n"
|
" ,...\n"
|
||||||
" ]\n"
|
" ]\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
|
},
|
||||||
"\nExamples:\n"
|
RPCExamples{
|
||||||
+ HelpExampleCli("signrawtransactionwithkey", "\"myhex\"")
|
HelpExampleCli("signrawtransactionwithkey", "\"myhex\"")
|
||||||
+ HelpExampleRpc("signrawtransactionwithkey", "\"myhex\"")
|
+ HelpExampleRpc("signrawtransactionwithkey", "\"myhex\"")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
RPCTypeCheck(request.params, {UniValue::VSTR, UniValue::VARR, UniValue::VARR, UniValue::VSTR}, true);
|
RPCTypeCheck(request.params, {UniValue::VSTR, UniValue::VARR, UniValue::VARR, UniValue::VSTR}, true);
|
||||||
|
|
||||||
|
@ -1015,11 +1022,11 @@ static UniValue sendrawtransaction(const JSONRPCRequest& request)
|
||||||
{
|
{
|
||||||
{"hexstring", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The hex string of the raw transaction"},
|
{"hexstring", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The hex string of the raw transaction"},
|
||||||
{"allowhighfees", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "Allow high fees"},
|
{"allowhighfees", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "Allow high fees"},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResult{
|
||||||
"\nResult:\n"
|
|
||||||
"\"hex\" (string) The transaction hash in hex\n"
|
"\"hex\" (string) The transaction hash in hex\n"
|
||||||
"\nExamples:\n"
|
},
|
||||||
|
RPCExamples{
|
||||||
"\nCreate a transaction\n"
|
"\nCreate a transaction\n"
|
||||||
+ HelpExampleCli("createrawtransaction", "\"[{\\\"txid\\\" : \\\"mytxid\\\",\\\"vout\\\":0}]\" \"{\\\"myaddress\\\":0.01}\"") +
|
+ HelpExampleCli("createrawtransaction", "\"[{\\\"txid\\\" : \\\"mytxid\\\",\\\"vout\\\":0}]\" \"{\\\"myaddress\\\":0.01}\"") +
|
||||||
"Sign the transaction, and get back the hex\n"
|
"Sign the transaction, and get back the hex\n"
|
||||||
|
@ -1028,7 +1035,8 @@ static UniValue sendrawtransaction(const JSONRPCRequest& request)
|
||||||
+ HelpExampleCli("sendrawtransaction", "\"signedhex\"") +
|
+ HelpExampleCli("sendrawtransaction", "\"signedhex\"") +
|
||||||
"\nAs a JSON-RPC call\n"
|
"\nAs a JSON-RPC call\n"
|
||||||
+ HelpExampleRpc("sendrawtransaction", "\"signedhex\"")
|
+ HelpExampleRpc("sendrawtransaction", "\"signedhex\"")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
std::promise<void> promise;
|
std::promise<void> promise;
|
||||||
|
|
||||||
|
@ -1118,9 +1126,8 @@ static UniValue testmempoolaccept(const JSONRPCRequest& request)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{"allowhighfees", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "Allow high fees"},
|
{"allowhighfees", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "Allow high fees"},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResult{
|
||||||
"\nResult:\n"
|
|
||||||
"[ (array) The result of the mempool acceptance test for each raw transaction in the input array.\n"
|
"[ (array) The result of the mempool acceptance test for each raw transaction in the input array.\n"
|
||||||
" Length is exactly one for now.\n"
|
" Length is exactly one for now.\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
|
@ -1129,7 +1136,8 @@ static UniValue testmempoolaccept(const JSONRPCRequest& request)
|
||||||
" \"reject-reason\" (string) Rejection string (only present when 'allowed' is false)\n"
|
" \"reject-reason\" (string) Rejection string (only present when 'allowed' is false)\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"]\n"
|
"]\n"
|
||||||
"\nExamples:\n"
|
},
|
||||||
|
RPCExamples{
|
||||||
"\nCreate a transaction\n"
|
"\nCreate a transaction\n"
|
||||||
+ HelpExampleCli("createrawtransaction", "\"[{\\\"txid\\\" : \\\"mytxid\\\",\\\"vout\\\":0}]\" \"{\\\"myaddress\\\":0.01}\"") +
|
+ HelpExampleCli("createrawtransaction", "\"[{\\\"txid\\\" : \\\"mytxid\\\",\\\"vout\\\":0}]\" \"{\\\"myaddress\\\":0.01}\"") +
|
||||||
"Sign the transaction, and get back the hex\n"
|
"Sign the transaction, and get back the hex\n"
|
||||||
|
@ -1138,7 +1146,8 @@ static UniValue testmempoolaccept(const JSONRPCRequest& request)
|
||||||
+ HelpExampleCli("testmempoolaccept", "[\"signedhex\"]") +
|
+ HelpExampleCli("testmempoolaccept", "[\"signedhex\"]") +
|
||||||
"\nAs a JSON-RPC call\n"
|
"\nAs a JSON-RPC call\n"
|
||||||
+ HelpExampleRpc("testmempoolaccept", "[\"signedhex\"]")
|
+ HelpExampleRpc("testmempoolaccept", "[\"signedhex\"]")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
RPCTypeCheck(request.params, {UniValue::VARR, UniValue::VBOOL});
|
RPCTypeCheck(request.params, {UniValue::VARR, UniValue::VBOOL});
|
||||||
|
@ -1212,9 +1221,8 @@ UniValue decodepsbt(const JSONRPCRequest& request)
|
||||||
"\nReturn a JSON object representing the serialized, base64-encoded partially signed Bitcoin transaction.\n",
|
"\nReturn a JSON object representing the serialized, base64-encoded partially signed Bitcoin transaction.\n",
|
||||||
{
|
{
|
||||||
{"psbt", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The PSBT base64 string"},
|
{"psbt", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The PSBT base64 string"},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResult{
|
||||||
"\nResult:\n"
|
|
||||||
"{\n"
|
"{\n"
|
||||||
" \"tx\" : { (json object) The decoded network-serialized unsigned transaction.\n"
|
" \"tx\" : { (json object) The decoded network-serialized unsigned transaction.\n"
|
||||||
" ... The layout is the same as the output of decoderawtransaction.\n"
|
" ... The layout is the same as the output of decoderawtransaction.\n"
|
||||||
|
@ -1301,10 +1309,11 @@ UniValue decodepsbt(const JSONRPCRequest& request)
|
||||||
" ]\n"
|
" ]\n"
|
||||||
" \"fee\" : fee (numeric, optional) The transaction fee paid if all UTXOs slots in the PSBT have been filled.\n"
|
" \"fee\" : fee (numeric, optional) The transaction fee paid if all UTXOs slots in the PSBT have been filled.\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
|
},
|
||||||
"\nExamples:\n"
|
RPCExamples{
|
||||||
+ HelpExampleCli("decodepsbt", "\"psbt\"")
|
HelpExampleCli("decodepsbt", "\"psbt\"")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
RPCTypeCheck(request.params, {UniValue::VSTR});
|
RPCTypeCheck(request.params, {UniValue::VSTR});
|
||||||
|
|
||||||
|
@ -1492,13 +1501,14 @@ UniValue combinepsbt(const JSONRPCRequest& request)
|
||||||
{"psbt", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "A base64 string of a PSBT"},
|
{"psbt", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "A base64 string of a PSBT"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResult{
|
||||||
"\nResult:\n"
|
|
||||||
" \"psbt\" (string) The base64-encoded partially signed transaction\n"
|
" \"psbt\" (string) The base64-encoded partially signed transaction\n"
|
||||||
"\nExamples:\n"
|
},
|
||||||
+ HelpExampleCli("combinepsbt", "[\"mybase64_1\", \"mybase64_2\", \"mybase64_3\"]")
|
RPCExamples{
|
||||||
);
|
HelpExampleCli("combinepsbt", "[\"mybase64_1\", \"mybase64_2\", \"mybase64_3\"]")
|
||||||
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
RPCTypeCheck(request.params, {UniValue::VARR}, true);
|
RPCTypeCheck(request.params, {UniValue::VARR}, true);
|
||||||
|
|
||||||
|
@ -1546,19 +1556,19 @@ UniValue finalizepsbt(const JSONRPCRequest& request)
|
||||||
{"psbt", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "A base64 string of a PSBT"},
|
{"psbt", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "A base64 string of a PSBT"},
|
||||||
{"extract", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "true", "If true and the transaction is complete,\n"
|
{"extract", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "true", "If true and the transaction is complete,\n"
|
||||||
" extract and return the complete transaction in normal network serialization instead of the PSBT."},
|
" extract and return the complete transaction in normal network serialization instead of the PSBT."},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResult{
|
||||||
"\nResult:\n"
|
|
||||||
"{\n"
|
"{\n"
|
||||||
" \"psbt\" : \"value\", (string) The base64-encoded partially signed transaction if not extracted\n"
|
" \"psbt\" : \"value\", (string) The base64-encoded partially signed transaction if not extracted\n"
|
||||||
" \"hex\" : \"value\", (string) The hex-encoded network transaction if extracted\n"
|
" \"hex\" : \"value\", (string) The hex-encoded network transaction if extracted\n"
|
||||||
" \"complete\" : true|false, (boolean) If the transaction has a complete set of signatures\n"
|
" \"complete\" : true|false, (boolean) If the transaction has a complete set of signatures\n"
|
||||||
" ]\n"
|
" ]\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
|
},
|
||||||
"\nExamples:\n"
|
RPCExamples{
|
||||||
+ HelpExampleCli("finalizepsbt", "\"psbt\"")
|
HelpExampleCli("finalizepsbt", "\"psbt\"")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
RPCTypeCheck(request.params, {UniValue::VSTR, UniValue::VBOOL}, true);
|
RPCTypeCheck(request.params, {UniValue::VSTR, UniValue::VBOOL}, true);
|
||||||
|
|
||||||
|
@ -1637,13 +1647,14 @@ UniValue createpsbt(const JSONRPCRequest& request)
|
||||||
{"locktime", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "0", "Raw locktime. Non-0 value also locktime-activates inputs"},
|
{"locktime", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "0", "Raw locktime. Non-0 value also locktime-activates inputs"},
|
||||||
{"replaceable", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "Marks this transaction as BIP125 replaceable.\n"
|
{"replaceable", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "Marks this transaction as BIP125 replaceable.\n"
|
||||||
" Allows this transaction to be replaced by a transaction with higher fees. If provided, it is an error if explicit sequence numbers are incompatible."},
|
" Allows this transaction to be replaced by a transaction with higher fees. If provided, it is an error if explicit sequence numbers are incompatible."},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResult{
|
||||||
"\nResult:\n"
|
|
||||||
" \"psbt\" (string) The resulting raw transaction (base64-encoded string)\n"
|
" \"psbt\" (string) The resulting raw transaction (base64-encoded string)\n"
|
||||||
"\nExamples:\n"
|
},
|
||||||
+ HelpExampleCli("createpsbt", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" \"[{\\\"data\\\":\\\"00010203\\\"}]\"")
|
RPCExamples{
|
||||||
);
|
HelpExampleCli("createpsbt", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" \"[{\\\"data\\\":\\\"00010203\\\"}]\"")
|
||||||
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
|
|
||||||
RPCTypeCheck(request.params, {
|
RPCTypeCheck(request.params, {
|
||||||
|
@ -1688,16 +1699,17 @@ UniValue converttopsbt(const JSONRPCRequest& request)
|
||||||
" If iswitness is not present, heuristic tests will be used in decoding. If true, only witness deserializaion\n"
|
" If iswitness is not present, heuristic tests will be used in decoding. If true, only witness deserializaion\n"
|
||||||
" will be tried. If false, only non-witness deserialization will be tried. Only has an effect if\n"
|
" will be tried. If false, only non-witness deserialization will be tried. Only has an effect if\n"
|
||||||
" permitsigdata is true."},
|
" permitsigdata is true."},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResult{
|
||||||
"\nResult:\n"
|
|
||||||
" \"psbt\" (string) The resulting raw transaction (base64-encoded string)\n"
|
" \"psbt\" (string) The resulting raw transaction (base64-encoded string)\n"
|
||||||
"\nExamples:\n"
|
},
|
||||||
|
RPCExamples{
|
||||||
"\nCreate a transaction\n"
|
"\nCreate a transaction\n"
|
||||||
+ HelpExampleCli("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" \"[{\\\"data\\\":\\\"00010203\\\"}]\"") +
|
+ HelpExampleCli("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" \"[{\\\"data\\\":\\\"00010203\\\"}]\"") +
|
||||||
"\nConvert the transaction to a PSBT\n"
|
"\nConvert the transaction to a PSBT\n"
|
||||||
+ HelpExampleCli("converttopsbt", "\"rawtransaction\"")
|
+ HelpExampleCli("converttopsbt", "\"rawtransaction\"")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
|
|
||||||
RPCTypeCheck(request.params, {UniValue::VSTR, UniValue::VBOOL, UniValue::VBOOL}, true);
|
RPCTypeCheck(request.params, {UniValue::VSTR, UniValue::VBOOL, UniValue::VBOOL}, true);
|
||||||
|
|
|
@ -231,10 +231,12 @@ UniValue help(const JSONRPCRequest& jsonRequest)
|
||||||
"\nList all commands, or get help for a specified command.\n",
|
"\nList all commands, or get help for a specified command.\n",
|
||||||
{
|
{
|
||||||
{"command", RPCArg::Type::STR, /* opt */ true, /* default_val */ "all commands", "The command to get help on"},
|
{"command", RPCArg::Type::STR, /* opt */ true, /* default_val */ "all commands", "The command to get help on"},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResult{
|
||||||
"\nResult:\n"
|
|
||||||
"\"text\" (string) The help text\n"
|
"\"text\" (string) The help text\n"
|
||||||
|
},
|
||||||
|
RPCExamples{""},
|
||||||
|
}.ToString()
|
||||||
);
|
);
|
||||||
|
|
||||||
std::string strCommand;
|
std::string strCommand;
|
||||||
|
@ -254,8 +256,11 @@ UniValue stop(const JSONRPCRequest& jsonRequest)
|
||||||
if (jsonRequest.fHelp || jsonRequest.params.size() > 1)
|
if (jsonRequest.fHelp || jsonRequest.params.size() > 1)
|
||||||
throw std::runtime_error(
|
throw std::runtime_error(
|
||||||
RPCHelpMan{"stop",
|
RPCHelpMan{"stop",
|
||||||
"\nStop Bitcoin server.", {}}
|
"\nStop Bitcoin server.",
|
||||||
.ToString());
|
{},
|
||||||
|
RPCResults{},
|
||||||
|
RPCExamples{""},
|
||||||
|
}.ToString());
|
||||||
// Event loop will exit after current HTTP requests have been handled, so
|
// Event loop will exit after current HTTP requests have been handled, so
|
||||||
// this reply will get back to the client.
|
// this reply will get back to the client.
|
||||||
StartShutdown();
|
StartShutdown();
|
||||||
|
@ -270,14 +275,16 @@ static UniValue uptime(const JSONRPCRequest& jsonRequest)
|
||||||
if (jsonRequest.fHelp || jsonRequest.params.size() > 0)
|
if (jsonRequest.fHelp || jsonRequest.params.size() > 0)
|
||||||
throw std::runtime_error(
|
throw std::runtime_error(
|
||||||
RPCHelpMan{"uptime",
|
RPCHelpMan{"uptime",
|
||||||
"\nReturns the total uptime of the server.\n", {}}
|
"\nReturns the total uptime of the server.\n",
|
||||||
.ToString() +
|
{},
|
||||||
"\nResult:\n"
|
RPCResult{
|
||||||
"ttt (numeric) The number of seconds that the server has been running\n"
|
"ttt (numeric) The number of seconds that the server has been running\n"
|
||||||
"\nExamples:\n"
|
},
|
||||||
+ HelpExampleCli("uptime", "")
|
RPCExamples{
|
||||||
|
HelpExampleCli("uptime", "")
|
||||||
+ HelpExampleRpc("uptime", "")
|
+ HelpExampleRpc("uptime", "")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
return GetTime() - GetStartupTime();
|
return GetTime() - GetStartupTime();
|
||||||
}
|
}
|
||||||
|
@ -287,8 +294,11 @@ static UniValue getrpcinfo(const JSONRPCRequest& request)
|
||||||
if (request.fHelp || request.params.size() > 0) {
|
if (request.fHelp || request.params.size() > 0) {
|
||||||
throw std::runtime_error(
|
throw std::runtime_error(
|
||||||
RPCHelpMan{"getrpcinfo",
|
RPCHelpMan{"getrpcinfo",
|
||||||
"\nReturns details of the RPC server.\n", {}}
|
"\nReturns details of the RPC server.\n",
|
||||||
.ToString()
|
{},
|
||||||
|
RPCResults{},
|
||||||
|
RPCExamples{""},
|
||||||
|
}.ToString()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -242,8 +242,12 @@ struct Sections {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
RPCHelpMan::RPCHelpMan(const std::string& name, const std::string& description, const std::vector<RPCArg>& args)
|
RPCHelpMan::RPCHelpMan(std::string name, std::string description, std::vector<RPCArg> args, RPCResults results, RPCExamples examples)
|
||||||
: m_name{name}, m_description{description}, m_args{args}
|
: m_name{std::move(name)},
|
||||||
|
m_description{std::move(description)},
|
||||||
|
m_args{std::move(args)},
|
||||||
|
m_results{std::move(results)},
|
||||||
|
m_examples{std::move(examples)}
|
||||||
{
|
{
|
||||||
std::set<std::string> named_args;
|
std::set<std::string> named_args;
|
||||||
for (const auto& arg : m_args) {
|
for (const auto& arg : m_args) {
|
||||||
|
@ -252,6 +256,25 @@ RPCHelpMan::RPCHelpMan(const std::string& name, const std::string& description,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string RPCResults::ToDescriptionString() const
|
||||||
|
{
|
||||||
|
std::string result;
|
||||||
|
for (const auto& r : m_results) {
|
||||||
|
if (r.m_cond.empty()) {
|
||||||
|
result += "\nResult:\n";
|
||||||
|
} else {
|
||||||
|
result += "\nResult (" + r.m_cond + "):\n";
|
||||||
|
}
|
||||||
|
result += r.m_result;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string RPCExamples::ToDescriptionString() const
|
||||||
|
{
|
||||||
|
return m_examples.empty() ? m_examples : "\nExamples:\n" + m_examples;
|
||||||
|
}
|
||||||
|
|
||||||
std::string RPCHelpMan::ToString() const
|
std::string RPCHelpMan::ToString() const
|
||||||
{
|
{
|
||||||
std::string ret;
|
std::string ret;
|
||||||
|
@ -292,6 +315,12 @@ std::string RPCHelpMan::ToString() const
|
||||||
}
|
}
|
||||||
ret += sections.ToString();
|
ret += sections.ToString();
|
||||||
|
|
||||||
|
// Result
|
||||||
|
ret += m_results.ToDescriptionString();
|
||||||
|
|
||||||
|
// Examples
|
||||||
|
ret += m_examples.ToDescriptionString();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -106,10 +106,62 @@ struct RPCArg {
|
||||||
std::string ToDescriptionString(bool implicitly_required = false) const;
|
std::string ToDescriptionString(bool implicitly_required = false) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct RPCResult {
|
||||||
|
const std::string m_cond;
|
||||||
|
const std::string m_result;
|
||||||
|
|
||||||
|
explicit RPCResult(std::string result)
|
||||||
|
: m_cond{}, m_result{std::move(result)}
|
||||||
|
{
|
||||||
|
assert(!m_result.empty());
|
||||||
|
}
|
||||||
|
|
||||||
|
RPCResult(std::string cond, std::string result)
|
||||||
|
: m_cond{std::move(cond)}, m_result{std::move(result)}
|
||||||
|
{
|
||||||
|
assert(!m_cond.empty());
|
||||||
|
assert(!m_result.empty());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct RPCResults {
|
||||||
|
const std::vector<RPCResult> m_results;
|
||||||
|
|
||||||
|
RPCResults()
|
||||||
|
: m_results{}
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
RPCResults(RPCResult result)
|
||||||
|
: m_results{{result}}
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
RPCResults(std::initializer_list<RPCResult> results)
|
||||||
|
: m_results{results}
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the description string.
|
||||||
|
*/
|
||||||
|
std::string ToDescriptionString() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct RPCExamples {
|
||||||
|
const std::string m_examples;
|
||||||
|
RPCExamples(
|
||||||
|
std::string examples)
|
||||||
|
: m_examples(std::move(examples))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
std::string ToDescriptionString() const;
|
||||||
|
};
|
||||||
|
|
||||||
class RPCHelpMan
|
class RPCHelpMan
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RPCHelpMan(const std::string& name, const std::string& description, const std::vector<RPCArg>& args);
|
RPCHelpMan(std::string name, std::string description, std::vector<RPCArg> args, RPCResults results, RPCExamples examples);
|
||||||
|
|
||||||
std::string ToString() const;
|
std::string ToString() const;
|
||||||
|
|
||||||
|
@ -117,6 +169,8 @@ private:
|
||||||
const std::string m_name;
|
const std::string m_name;
|
||||||
const std::string m_description;
|
const std::string m_description;
|
||||||
const std::vector<RPCArg> m_args;
|
const std::vector<RPCArg> m_args;
|
||||||
|
const RPCResults m_results;
|
||||||
|
const RPCExamples m_examples;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BITCOIN_RPC_UTIL_H
|
#endif // BITCOIN_RPC_UTIL_H
|
||||||
|
|
|
@ -111,16 +111,16 @@ UniValue importprivkey(const JSONRPCRequest& request)
|
||||||
throw std::runtime_error(
|
throw std::runtime_error(
|
||||||
RPCHelpMan{"importprivkey",
|
RPCHelpMan{"importprivkey",
|
||||||
"\nAdds a private key (as returned by dumpprivkey) to your wallet. Requires a new wallet backup.\n"
|
"\nAdds a private key (as returned by dumpprivkey) to your wallet. Requires a new wallet backup.\n"
|
||||||
"Hint: use importmulti to import more than one private key.\n",
|
"Hint: use importmulti to import more than one private key.\n"
|
||||||
|
"\nNote: This call can take over an hour to complete if rescan is true, during that time, other rpc calls\n"
|
||||||
|
"may report that the imported key exists but related transactions are still missing, leading to temporarily incorrect/bogus balances and unspent outputs until rescan completes.\n",
|
||||||
{
|
{
|
||||||
{"privkey", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The private key (see dumpprivkey)"},
|
{"privkey", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The private key (see dumpprivkey)"},
|
||||||
{"label", RPCArg::Type::STR, /* opt */ true, /* default_val */ "current label if address exists, otherwise \"\"", "An optional label"},
|
{"label", RPCArg::Type::STR, /* opt */ true, /* default_val */ "current label if address exists, otherwise \"\"", "An optional label"},
|
||||||
{"rescan", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "true", "Rescan the wallet for transactions"},
|
{"rescan", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "true", "Rescan the wallet for transactions"},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResults{},
|
||||||
"\nNote: This call can take over an hour to complete if rescan is true, during that time, other rpc calls\n"
|
RPCExamples{
|
||||||
"may report that the imported key exists but related transactions are still missing, leading to temporarily incorrect/bogus balances and unspent outputs until rescan completes.\n"
|
|
||||||
"\nExamples:\n"
|
|
||||||
"\nDump a private key\n"
|
"\nDump a private key\n"
|
||||||
+ HelpExampleCli("dumpprivkey", "\"myaddress\"") +
|
+ HelpExampleCli("dumpprivkey", "\"myaddress\"") +
|
||||||
"\nImport the private key with rescan\n"
|
"\nImport the private key with rescan\n"
|
||||||
|
@ -131,7 +131,8 @@ UniValue importprivkey(const JSONRPCRequest& request)
|
||||||
+ HelpExampleCli("importprivkey", "\"mykey\" \"\" false") +
|
+ HelpExampleCli("importprivkey", "\"mykey\" \"\" false") +
|
||||||
"\nAs a JSON-RPC call\n"
|
"\nAs a JSON-RPC call\n"
|
||||||
+ HelpExampleRpc("importprivkey", "\"mykey\", \"testing\", false")
|
+ HelpExampleRpc("importprivkey", "\"mykey\", \"testing\", false")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
|
|
||||||
WalletRescanReserver reserver(pwallet);
|
WalletRescanReserver reserver(pwallet);
|
||||||
|
@ -209,16 +210,18 @@ UniValue abortrescan(const JSONRPCRequest& request)
|
||||||
if (request.fHelp || request.params.size() > 0)
|
if (request.fHelp || request.params.size() > 0)
|
||||||
throw std::runtime_error(
|
throw std::runtime_error(
|
||||||
RPCHelpMan{"abortrescan",
|
RPCHelpMan{"abortrescan",
|
||||||
"\nStops current wallet rescan triggered by an RPC call, e.g. by an importprivkey call.\n", {}}
|
"\nStops current wallet rescan triggered by an RPC call, e.g. by an importprivkey call.\n",
|
||||||
.ToString() +
|
{},
|
||||||
"\nExamples:\n"
|
RPCResults{},
|
||||||
|
RPCExamples{
|
||||||
"\nImport a private key\n"
|
"\nImport a private key\n"
|
||||||
+ HelpExampleCli("importprivkey", "\"mykey\"") +
|
+ HelpExampleCli("importprivkey", "\"mykey\"") +
|
||||||
"\nAbort the running wallet rescan\n"
|
"\nAbort the running wallet rescan\n"
|
||||||
+ HelpExampleCli("abortrescan", "") +
|
+ HelpExampleCli("abortrescan", "") +
|
||||||
"\nAs a JSON-RPC call\n"
|
"\nAs a JSON-RPC call\n"
|
||||||
+ HelpExampleRpc("abortrescan", "")
|
+ HelpExampleRpc("abortrescan", "")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
if (!pwallet->IsScanning() || pwallet->IsAbortingRescan()) return false;
|
if (!pwallet->IsScanning() || pwallet->IsAbortingRescan()) return false;
|
||||||
pwallet->AbortRescan();
|
pwallet->AbortRescan();
|
||||||
|
@ -272,27 +275,28 @@ UniValue importaddress(const JSONRPCRequest& request)
|
||||||
if (request.fHelp || request.params.size() < 1 || request.params.size() > 4)
|
if (request.fHelp || request.params.size() < 1 || request.params.size() > 4)
|
||||||
throw std::runtime_error(
|
throw std::runtime_error(
|
||||||
RPCHelpMan{"importaddress",
|
RPCHelpMan{"importaddress",
|
||||||
"\nAdds an address or script (in hex) that can be watched as if it were in your wallet but cannot be used to spend. Requires a new wallet backup.\n",
|
"\nAdds an address or script (in hex) that can be watched as if it were in your wallet but cannot be used to spend. Requires a new wallet backup.\n"
|
||||||
|
"\nNote: This call can take over an hour to complete if rescan is true, during that time, other rpc calls\n"
|
||||||
|
"may report that the imported address exists but related transactions are still missing, leading to temporarily incorrect/bogus balances and unspent outputs until rescan completes.\n"
|
||||||
|
"If you have the full public key, you should call importpubkey instead of this.\n"
|
||||||
|
"\nNote: If you import a non-standard raw script in hex form, outputs sending to it will be treated\n"
|
||||||
|
"as change, and not show up in many RPCs.\n",
|
||||||
{
|
{
|
||||||
{"address", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The Bitcoin address (or hex-encoded script)"},
|
{"address", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The Bitcoin address (or hex-encoded script)"},
|
||||||
{"label", RPCArg::Type::STR, /* opt */ true, /* default_val */ "\"\"", "An optional label"},
|
{"label", RPCArg::Type::STR, /* opt */ true, /* default_val */ "\"\"", "An optional label"},
|
||||||
{"rescan", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "true", "Rescan the wallet for transactions"},
|
{"rescan", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "true", "Rescan the wallet for transactions"},
|
||||||
{"p2sh", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "Add the P2SH version of the script as well"},
|
{"p2sh", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "Add the P2SH version of the script as well"},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResults{},
|
||||||
"\nNote: This call can take over an hour to complete if rescan is true, during that time, other rpc calls\n"
|
RPCExamples{
|
||||||
"may report that the imported address exists but related transactions are still missing, leading to temporarily incorrect/bogus balances and unspent outputs until rescan completes.\n"
|
|
||||||
"If you have the full public key, you should call importpubkey instead of this.\n"
|
|
||||||
"\nNote: If you import a non-standard raw script in hex form, outputs sending to it will be treated\n"
|
|
||||||
"as change, and not show up in many RPCs.\n"
|
|
||||||
"\nExamples:\n"
|
|
||||||
"\nImport an address with rescan\n"
|
"\nImport an address with rescan\n"
|
||||||
+ HelpExampleCli("importaddress", "\"myaddress\"") +
|
+ HelpExampleCli("importaddress", "\"myaddress\"") +
|
||||||
"\nImport using a label without rescan\n"
|
"\nImport using a label without rescan\n"
|
||||||
+ HelpExampleCli("importaddress", "\"myaddress\" \"testing\" false") +
|
+ HelpExampleCli("importaddress", "\"myaddress\" \"testing\" false") +
|
||||||
"\nAs a JSON-RPC call\n"
|
"\nAs a JSON-RPC call\n"
|
||||||
+ HelpExampleRpc("importaddress", "\"myaddress\", \"testing\", false")
|
+ HelpExampleRpc("importaddress", "\"myaddress\", \"testing\", false")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
|
|
||||||
std::string strLabel;
|
std::string strLabel;
|
||||||
|
@ -358,8 +362,10 @@ UniValue importprunedfunds(const JSONRPCRequest& request)
|
||||||
{
|
{
|
||||||
{"rawtransaction", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "A raw transaction in hex funding an already-existing address in wallet"},
|
{"rawtransaction", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "A raw transaction in hex funding an already-existing address in wallet"},
|
||||||
{"txoutproof", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The hex output from gettxoutproof that contains the transaction"},
|
{"txoutproof", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The hex output from gettxoutproof that contains the transaction"},
|
||||||
}}
|
},
|
||||||
.ToString()
|
RPCResults{},
|
||||||
|
RPCExamples{""},
|
||||||
|
}.ToString()
|
||||||
);
|
);
|
||||||
|
|
||||||
CMutableTransaction tx;
|
CMutableTransaction tx;
|
||||||
|
@ -423,13 +429,14 @@ UniValue removeprunedfunds(const JSONRPCRequest& request)
|
||||||
"\nDeletes the specified transaction from the wallet. Meant for use with pruned wallets and as a companion to importprunedfunds. This will affect wallet balances.\n",
|
"\nDeletes the specified transaction from the wallet. Meant for use with pruned wallets and as a companion to importprunedfunds. This will affect wallet balances.\n",
|
||||||
{
|
{
|
||||||
{"txid", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The hex-encoded id of the transaction you are deleting"},
|
{"txid", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The hex-encoded id of the transaction you are deleting"},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResults{},
|
||||||
"\nExamples:\n"
|
RPCExamples{
|
||||||
+ HelpExampleCli("removeprunedfunds", "\"a8d0c0184dde994a09ec054286f1ce581bebf46446a512166eae7628734ea0a5\"") +
|
HelpExampleCli("removeprunedfunds", "\"a8d0c0184dde994a09ec054286f1ce581bebf46446a512166eae7628734ea0a5\"") +
|
||||||
"\nAs a JSON-RPC call\n"
|
"\nAs a JSON-RPC call\n"
|
||||||
+ HelpExampleRpc("removeprunedfunds", "\"a8d0c0184dde994a09ec054286f1ce581bebf46446a512166eae7628734ea0a5\"")
|
+ HelpExampleRpc("removeprunedfunds", "\"a8d0c0184dde994a09ec054286f1ce581bebf46446a512166eae7628734ea0a5\"")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
auto locked_chain = pwallet->chain().lock();
|
auto locked_chain = pwallet->chain().lock();
|
||||||
LOCK(pwallet->cs_wallet);
|
LOCK(pwallet->cs_wallet);
|
||||||
|
@ -461,23 +468,24 @@ UniValue importpubkey(const JSONRPCRequest& request)
|
||||||
if (request.fHelp || request.params.size() < 1 || request.params.size() > 3)
|
if (request.fHelp || request.params.size() < 1 || request.params.size() > 3)
|
||||||
throw std::runtime_error(
|
throw std::runtime_error(
|
||||||
RPCHelpMan{"importpubkey",
|
RPCHelpMan{"importpubkey",
|
||||||
"\nAdds a public key (in hex) that can be watched as if it were in your wallet but cannot be used to spend. Requires a new wallet backup.\n",
|
"\nAdds a public key (in hex) that can be watched as if it were in your wallet but cannot be used to spend. Requires a new wallet backup.\n"
|
||||||
|
"\nNote: This call can take over an hour to complete if rescan is true, during that time, other rpc calls\n"
|
||||||
|
"may report that the imported pubkey exists but related transactions are still missing, leading to temporarily incorrect/bogus balances and unspent outputs until rescan completes.\n",
|
||||||
{
|
{
|
||||||
{"pubkey", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The hex-encoded public key"},
|
{"pubkey", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The hex-encoded public key"},
|
||||||
{"label", RPCArg::Type::STR, /* opt */ true, /* default_val */ "\"\"", "An optional label"},
|
{"label", RPCArg::Type::STR, /* opt */ true, /* default_val */ "\"\"", "An optional label"},
|
||||||
{"rescan", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "true", "Rescan the wallet for transactions"},
|
{"rescan", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "true", "Rescan the wallet for transactions"},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResults{},
|
||||||
"\nNote: This call can take over an hour to complete if rescan is true, during that time, other rpc calls\n"
|
RPCExamples{
|
||||||
"may report that the imported pubkey exists but related transactions are still missing, leading to temporarily incorrect/bogus balances and unspent outputs until rescan completes.\n"
|
|
||||||
"\nExamples:\n"
|
|
||||||
"\nImport a public key with rescan\n"
|
"\nImport a public key with rescan\n"
|
||||||
+ HelpExampleCli("importpubkey", "\"mypubkey\"") +
|
+ HelpExampleCli("importpubkey", "\"mypubkey\"") +
|
||||||
"\nImport using a label without rescan\n"
|
"\nImport using a label without rescan\n"
|
||||||
+ HelpExampleCli("importpubkey", "\"mypubkey\" \"testing\" false") +
|
+ HelpExampleCli("importpubkey", "\"mypubkey\" \"testing\" false") +
|
||||||
"\nAs a JSON-RPC call\n"
|
"\nAs a JSON-RPC call\n"
|
||||||
+ HelpExampleRpc("importpubkey", "\"mypubkey\", \"testing\", false")
|
+ HelpExampleRpc("importpubkey", "\"mypubkey\", \"testing\", false")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
|
|
||||||
std::string strLabel;
|
std::string strLabel;
|
||||||
|
@ -538,16 +546,17 @@ UniValue importwallet(const JSONRPCRequest& request)
|
||||||
"\nImports keys from a wallet dump file (see dumpwallet). Requires a new wallet backup to include imported keys.\n",
|
"\nImports keys from a wallet dump file (see dumpwallet). Requires a new wallet backup to include imported keys.\n",
|
||||||
{
|
{
|
||||||
{"filename", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The wallet file"},
|
{"filename", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The wallet file"},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResults{},
|
||||||
"\nExamples:\n"
|
RPCExamples{
|
||||||
"\nDump the wallet\n"
|
"\nDump the wallet\n"
|
||||||
+ HelpExampleCli("dumpwallet", "\"test\"") +
|
+ HelpExampleCli("dumpwallet", "\"test\"") +
|
||||||
"\nImport the wallet\n"
|
"\nImport the wallet\n"
|
||||||
+ HelpExampleCli("importwallet", "\"test\"") +
|
+ HelpExampleCli("importwallet", "\"test\"") +
|
||||||
"\nImport using the json rpc call\n"
|
"\nImport using the json rpc call\n"
|
||||||
+ HelpExampleRpc("importwallet", "\"test\"")
|
+ HelpExampleRpc("importwallet", "\"test\"")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
if (fPruneMode)
|
if (fPruneMode)
|
||||||
throw JSONRPCError(RPC_WALLET_ERROR, "Importing wallets is disabled in pruned mode");
|
throw JSONRPCError(RPC_WALLET_ERROR, "Importing wallets is disabled in pruned mode");
|
||||||
|
@ -671,15 +680,16 @@ UniValue dumpprivkey(const JSONRPCRequest& request)
|
||||||
"Then the importprivkey can be used with this output\n",
|
"Then the importprivkey can be used with this output\n",
|
||||||
{
|
{
|
||||||
{"address", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The bitcoin address for the private key"},
|
{"address", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The bitcoin address for the private key"},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResult{
|
||||||
"\nResult:\n"
|
|
||||||
"\"key\" (string) The private key\n"
|
"\"key\" (string) The private key\n"
|
||||||
"\nExamples:\n"
|
},
|
||||||
+ HelpExampleCli("dumpprivkey", "\"myaddress\"")
|
RPCExamples{
|
||||||
|
HelpExampleCli("dumpprivkey", "\"myaddress\"")
|
||||||
+ HelpExampleCli("importprivkey", "\"mykey\"")
|
+ HelpExampleCli("importprivkey", "\"mykey\"")
|
||||||
+ HelpExampleRpc("dumpprivkey", "\"myaddress\"")
|
+ HelpExampleRpc("dumpprivkey", "\"myaddress\"")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
auto locked_chain = pwallet->chain().lock();
|
auto locked_chain = pwallet->chain().lock();
|
||||||
LOCK(pwallet->cs_wallet);
|
LOCK(pwallet->cs_wallet);
|
||||||
|
@ -720,16 +730,17 @@ UniValue dumpwallet(const JSONRPCRequest& request)
|
||||||
"only backing up the seed itself, and must be backed up too (e.g. ensure you back up the whole dumpfile).\n",
|
"only backing up the seed itself, and must be backed up too (e.g. ensure you back up the whole dumpfile).\n",
|
||||||
{
|
{
|
||||||
{"filename", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The filename with path (either absolute or relative to bitcoind)"},
|
{"filename", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The filename with path (either absolute or relative to bitcoind)"},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResult{
|
||||||
"\nResult:\n"
|
|
||||||
"{ (json object)\n"
|
"{ (json object)\n"
|
||||||
" \"filename\" : { (string) The filename with full absolute path\n"
|
" \"filename\" : { (string) The filename with full absolute path\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\nExamples:\n"
|
},
|
||||||
+ HelpExampleCli("dumpwallet", "\"test\"")
|
RPCExamples{
|
||||||
|
HelpExampleCli("dumpwallet", "\"test\"")
|
||||||
+ HelpExampleRpc("dumpwallet", "\"test\"")
|
+ HelpExampleRpc("dumpwallet", "\"test\"")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
|
|
||||||
auto locked_chain = pwallet->chain().lock();
|
auto locked_chain = pwallet->chain().lock();
|
||||||
LOCK(pwallet->cs_wallet);
|
LOCK(pwallet->cs_wallet);
|
||||||
|
@ -1150,7 +1161,9 @@ UniValue importmulti(const JSONRPCRequest& mainRequest)
|
||||||
RPCHelpMan{"importmulti",
|
RPCHelpMan{"importmulti",
|
||||||
"\nImport addresses/scripts (with private or public keys, redeem script (P2SH)), optionally rescanning the blockchain from the earliest creation time of the imported scripts. Requires a new wallet backup.\n"
|
"\nImport addresses/scripts (with private or public keys, redeem script (P2SH)), optionally rescanning the blockchain from the earliest creation time of the imported scripts. Requires a new wallet backup.\n"
|
||||||
"If an address/script is imported without all of the private keys required to spend from that address, it will be watchonly. The 'watchonly' option must be set to true in this case or a warning will be returned.\n"
|
"If an address/script is imported without all of the private keys required to spend from that address, it will be watchonly. The 'watchonly' option must be set to true in this case or a warning will be returned.\n"
|
||||||
"Conversely, if all the private keys are provided and the address/script is spendable, the watchonly option must be set to false, or a warning will be returned.\n",
|
"Conversely, if all the private keys are provided and the address/script is spendable, the watchonly option must be set to false, or a warning will be returned.\n"
|
||||||
|
"\nNote: This call can take over an hour to complete if rescan is true, during that time, other rpc calls\n"
|
||||||
|
"may report that the imported keys, addresses or scripts exists but related transactions are still missing.\n",
|
||||||
{
|
{
|
||||||
{"requests", RPCArg::Type::ARR, /* opt */ false, /* default_val */ "", "Data to be imported",
|
{"requests", RPCArg::Type::ARR, /* opt */ false, /* default_val */ "", "Data to be imported",
|
||||||
{
|
{
|
||||||
|
@ -1191,17 +1204,18 @@ UniValue importmulti(const JSONRPCRequest& mainRequest)
|
||||||
{"rescan", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "true", "Stating if should rescan the blockchain after all imports"},
|
{"rescan", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "true", "Stating if should rescan the blockchain after all imports"},
|
||||||
},
|
},
|
||||||
"\"options\""},
|
"\"options\""},
|
||||||
}}
|
},
|
||||||
.ToString() +
|
RPCResult{
|
||||||
"\nNote: This call can take over an hour to complete if rescan is true, during that time, other rpc calls\n"
|
|
||||||
"may report that the imported keys, addresses or scripts exists but related transactions are still missing.\n"
|
|
||||||
"\nExamples:\n" +
|
|
||||||
HelpExampleCli("importmulti", "'[{ \"scriptPubKey\": { \"address\": \"<my address>\" }, \"timestamp\":1455191478 }, "
|
|
||||||
"{ \"scriptPubKey\": { \"address\": \"<my 2nd address>\" }, \"label\": \"example 2\", \"timestamp\": 1455191480 }]'") +
|
|
||||||
HelpExampleCli("importmulti", "'[{ \"scriptPubKey\": { \"address\": \"<my address>\" }, \"timestamp\":1455191478 }]' '{ \"rescan\": false}'") +
|
|
||||||
|
|
||||||
"\nResponse is an array with the same size as the input that has the execution result :\n"
|
"\nResponse is an array with the same size as the input that has the execution result :\n"
|
||||||
" [{\"success\": true}, {\"success\": true, \"warnings\": [\"Ignoring irrelevant private key\"]}, {\"success\": false, \"error\": {\"code\": -1, \"message\": \"Internal Server Error\"}}, ...]\n");
|
" [{\"success\": true}, {\"success\": true, \"warnings\": [\"Ignoring irrelevant private key\"]}, {\"success\": false, \"error\": {\"code\": -1, \"message\": \"Internal Server Error\"}}, ...]\n"
|
||||||
|
},
|
||||||
|
RPCExamples{
|
||||||
|
HelpExampleCli("importmulti", "'[{ \"scriptPubKey\": { \"address\": \"<my address>\" }, \"timestamp\":1455191478 }, "
|
||||||
|
"{ \"scriptPubKey\": { \"address\": \"<my 2nd address>\" }, \"label\": \"example 2\", \"timestamp\": 1455191480 }]'") +
|
||||||
|
HelpExampleCli("importmulti", "'[{ \"scriptPubKey\": { \"address\": \"<my address>\" }, \"timestamp\":1455191478 }]' '{ \"rescan\": false}'")
|
||||||
|
},
|
||||||
|
}.ToString()
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
RPCTypeCheck(mainRequest.params, {UniValue::VARR, UniValue::VOBJ});
|
RPCTypeCheck(mainRequest.params, {UniValue::VARR, UniValue::VOBJ});
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -18,9 +18,9 @@ UniValue getzmqnotifications(const JSONRPCRequest& request)
|
||||||
if (request.fHelp || request.params.size() != 0) {
|
if (request.fHelp || request.params.size() != 0) {
|
||||||
throw std::runtime_error(
|
throw std::runtime_error(
|
||||||
RPCHelpMan{"getzmqnotifications",
|
RPCHelpMan{"getzmqnotifications",
|
||||||
"\nReturns information about the active ZeroMQ notifications.\n", {}}
|
"\nReturns information about the active ZeroMQ notifications.\n",
|
||||||
.ToString() +
|
{},
|
||||||
"\nResult:\n"
|
RPCResult{
|
||||||
"[\n"
|
"[\n"
|
||||||
" { (json object)\n"
|
" { (json object)\n"
|
||||||
" \"type\": \"pubhashtx\", (string) Type of notification\n"
|
" \"type\": \"pubhashtx\", (string) Type of notification\n"
|
||||||
|
@ -29,10 +29,12 @@ UniValue getzmqnotifications(const JSONRPCRequest& request)
|
||||||
" },\n"
|
" },\n"
|
||||||
" ...\n"
|
" ...\n"
|
||||||
"]\n"
|
"]\n"
|
||||||
"\nExamples:\n"
|
},
|
||||||
+ HelpExampleCli("getzmqnotifications", "")
|
RPCExamples{
|
||||||
|
HelpExampleCli("getzmqnotifications", "")
|
||||||
+ HelpExampleRpc("getzmqnotifications", "")
|
+ HelpExampleRpc("getzmqnotifications", "")
|
||||||
);
|
},
|
||||||
|
}.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
UniValue result(UniValue::VARR);
|
UniValue result(UniValue::VARR);
|
||||||
|
|
Loading…
Reference in a new issue