Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/blockchain.cpp
Show First 20 Lines • Show All 153 Lines • ▼ Show 20 Lines | |||||
static UniValue getblockcount(const Config &config, | static UniValue getblockcount(const Config &config, | ||||
const JSONRPCRequest &request) { | 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{ | RPCHelpMan{ | ||||
"getblockcount", | "getblockcount", | ||||
"\nReturns the number of blocks in the longest blockchain.\n", | "\nReturns the number of blocks in the longest blockchain.\n", | ||||
{}} | {}} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"n (numeric) The current block count\n" | "n (numeric) The current block count\n" | ||||
"\nExamples:\n" + | "\nExamples:\n" + | ||||
HelpExampleCli("getblockcount", "") + | HelpExampleCli("getblockcount", "") + | ||||
HelpExampleRpc("getblockcount", "")); | HelpExampleRpc("getblockcount", "")); | ||||
} | } | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
return ::ChainActive().Height(); | return ::ChainActive().Height(); | ||||
} | } | ||||
static UniValue getbestblockhash(const Config &config, | static UniValue getbestblockhash(const Config &config, | ||||
const JSONRPCRequest &request) { | 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 " | "\nReturns the hash of the best (tip) block in the " | ||||
"longest blockchain.\n", | "longest blockchain.\n", | ||||
{}} | {}} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"\"hex\" (string) the block hash hex-encoded\n" | "\"hex\" (string) the block hash hex-encoded\n" | ||||
"\nExamples:\n" + | "\nExamples:\n" + | ||||
HelpExampleCli("getbestblockhash", "") + | HelpExampleCli("getbestblockhash", "") + | ||||
HelpExampleRpc("getbestblockhash", "")); | HelpExampleRpc("getbestblockhash", "")); | ||||
} | } | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
return ::ChainActive().Tip()->GetBlockHash().GetHex(); | return ::ChainActive().Tip()->GetBlockHash().GetHex(); | ||||
} | } | ||||
UniValue getfinalizedblockhash(const Config &config, | UniValue getfinalizedblockhash(const Config &config, | ||||
const JSONRPCRequest &request) { | 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{"getfinalizedblockhash", | RPCHelpMan{"getfinalizedblockhash", | ||||
"\nReturns the hash of the currently finalized block\n", | "\nReturns the hash of the currently finalized block\n", | ||||
{}} | {}} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"\"hex\" (string) the block hash hex-encoded\n"); | "\"hex\" (string) the block hash hex-encoded\n"); | ||||
} | } | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
const CBlockIndex *blockIndexFinalized = GetFinalizedBlock(); | const CBlockIndex *blockIndexFinalized = GetFinalizedBlock(); | ||||
if (blockIndexFinalized) { | if (blockIndexFinalized) { | ||||
return blockIndexFinalized->GetBlockHash().GetHex(); | return blockIndexFinalized->GetBlockHash().GetHex(); | ||||
Show All 19 Lines | if (request.fHelp || request.params.size() > 1) { | ||||
"info about it.\n" | "info about it.\n" | ||||
"\nReturns the current block on timeout or exit.\n", | "\nReturns the current block on timeout or exit.\n", | ||||
{ | { | ||||
{"timeout", RPCArg::Type::NUM, /* opt */ true, | {"timeout", RPCArg::Type::NUM, /* opt */ true, | ||||
/* default_val */ "0", | /* default_val */ "0", | ||||
"Time in milliseconds to wait for a response. 0 " | "Time in milliseconds to wait for a response. 0 " | ||||
"indicates no timeout."}, | "indicates no timeout."}, | ||||
}} | }} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\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" + | "\nExamples:\n" + | ||||
HelpExampleCli("waitfornewblock", "1000") + | HelpExampleCli("waitfornewblock", "1000") + | ||||
HelpExampleRpc("waitfornewblock", "1000")); | HelpExampleRpc("waitfornewblock", "1000")); | ||||
Show All 40 Lines | if (request.fHelp || request.params.size() < 1 || | ||||
{ | { | ||||
{"blockhash", RPCArg::Type::STR_HEX, /* opt */ false, | {"blockhash", RPCArg::Type::STR_HEX, /* opt */ false, | ||||
/* default_val */ "", "Block hash to wait for."}, | /* default_val */ "", "Block hash to wait for."}, | ||||
{"timeout", RPCArg::Type::NUM, /* opt */ true, | {"timeout", RPCArg::Type::NUM, /* opt */ true, | ||||
/* default_val */ "0", | /* default_val */ "0", | ||||
"Time in milliseconds to wait for a response. 0 " | "Time in milliseconds to wait for a response. 0 " | ||||
"indicates no timeout."}, | "indicates no timeout."}, | ||||
}} | }} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\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" + | "\nExamples:\n" + | ||||
HelpExampleCli("waitforblock", "\"0000000000079f8ef3d2c688c244eb7a4" | HelpExampleCli("waitforblock", "\"0000000000079f8ef3d2c688c244eb7a4" | ||||
"570b24c9ed7b4a8c619eb02596f8862\", " | "570b24c9ed7b4a8c619eb02596f8862\", " | ||||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() < 1 || | ||||
{ | { | ||||
{"height", RPCArg::Type::NUM, /* opt */ false, | {"height", RPCArg::Type::NUM, /* opt */ false, | ||||
/* default_val */ "", "Block height to wait for."}, | /* default_val */ "", "Block height to wait for."}, | ||||
{"timeout", RPCArg::Type::NUM, /* opt */ true, | {"timeout", RPCArg::Type::NUM, /* opt */ true, | ||||
/* default_val */ "0", | /* default_val */ "0", | ||||
"Time in milliseconds to wait for a response. 0 " | "Time in milliseconds to wait for a response. 0 " | ||||
"indicates no timeout."}, | "indicates no timeout."}, | ||||
}} | }} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\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" + | "\nExamples:\n" + | ||||
HelpExampleCli("waitforblockheight", "\"100\", 1000") + | HelpExampleCli("waitforblockheight", "\"100\", 1000") + | ||||
HelpExampleRpc("waitforblockheight", "\"100\", 1000")); | HelpExampleRpc("waitforblockheight", "\"100\", 1000")); | ||||
Show All 33 Lines | syncwithvalidationinterfacequeue(const Config &config, | ||||
const JSONRPCRequest &request) { | 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{ | RPCHelpMan{ | ||||
"syncwithvalidationinterfacequeue", | "syncwithvalidationinterfacequeue", | ||||
"\nWaits for the validation interface queue to catch up on " | "\nWaits for the validation interface queue to catch up on " | ||||
"everything that was there when we entered this function.\n", | "everything that was there when we entered this function.\n", | ||||
{}} | {}} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nExamples:\n" + | "\nExamples:\n" + | ||||
HelpExampleCli("syncwithvalidationinterfacequeue", "") + | HelpExampleCli("syncwithvalidationinterfacequeue", "") + | ||||
HelpExampleRpc("syncwithvalidationinterfacequeue", "")); | HelpExampleRpc("syncwithvalidationinterfacequeue", "")); | ||||
} | } | ||||
SyncWithValidationInterfaceQueue(); | SyncWithValidationInterfaceQueue(); | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
static UniValue getdifficulty(const Config &config, | static UniValue getdifficulty(const Config &config, | ||||
const JSONRPCRequest &request) { | 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 " | "\nReturns the proof-of-work difficulty as a " | ||||
"multiple of the minimum difficulty.\n", | "multiple of the minimum difficulty.\n", | ||||
{}} | {}} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"n.nnn (numeric) the proof-of-work " | "n.nnn (numeric) the proof-of-work " | ||||
"difficulty as a multiple of the minimum " | "difficulty as a multiple of the minimum " | ||||
"difficulty.\n" | "difficulty.\n" | ||||
"\nExamples:\n" + | "\nExamples:\n" + | ||||
HelpExampleCli("getdifficulty", "") + | HelpExampleCli("getdifficulty", "") + | ||||
HelpExampleRpc("getdifficulty", "")); | HelpExampleRpc("getdifficulty", "")); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 134 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() > 1) { | ||||
"\nHint: use getmempoolentry to fetch a specific " | "\nHint: use getmempoolentry to fetch a specific " | ||||
"transaction from the mempool.\n", | "transaction from the mempool.\n", | ||||
{ | { | ||||
{"verbose", RPCArg::Type::BOOL, /* opt */ true, | {"verbose", RPCArg::Type::BOOL, /* opt */ true, | ||||
/* default_val */ "false", | /* default_val */ "false", | ||||
"True for a json object, false for array of " | "True for a json object, false for array of " | ||||
"transaction ids"}, | "transaction ids"}, | ||||
}} | }} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult: (for verbose = false):\n" | "\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" | ||||
"]\n" | "]\n" | ||||
"\nResult: (for verbose = true):\n" | "\nResult: (for verbose = true):\n" | ||||
"{ (json object)\n" | "{ (json object)\n" | ||||
" \"transactionid\" : { (json object)\n" + | " \"transactionid\" : { (json object)\n" + | ||||
Show All 25 Lines | if (request.fHelp || request.params.size() < 1 || | ||||
{"txid", RPCArg::Type::STR_HEX, /* opt */ false, | {"txid", RPCArg::Type::STR_HEX, /* opt */ false, | ||||
/* default_val */ "", | /* default_val */ "", | ||||
"The transaction id (must be in mempool)"}, | "The transaction id (must be in mempool)"}, | ||||
{"verbose", RPCArg::Type::BOOL, /* opt */ true, | {"verbose", RPCArg::Type::BOOL, /* opt */ true, | ||||
/* default_val */ "false", | /* default_val */ "false", | ||||
"True for a json object, false for array of " | "True for a json object, false for array of " | ||||
"transaction ids"}, | "transaction ids"}, | ||||
}} | }} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult (for verbose = false):\n" | "\nResult (for verbose = false):\n" | ||||
"[ (json array of strings)\n" | "[ (json array of strings)\n" | ||||
" \"transactionid\" (string) The transaction id of an " | " \"transactionid\" (string) The transaction id of an " | ||||
"in-mempool ancestor transaction\n" | "in-mempool ancestor transaction\n" | ||||
" ,...\n" | " ,...\n" | ||||
"]\n" | "]\n" | ||||
"\nResult (for verbose = true):\n" | "\nResult (for verbose = true):\n" | ||||
"{ (json object)\n" | "{ (json object)\n" | ||||
▲ Show 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() < 1 || | ||||
{"txid", RPCArg::Type::STR_HEX, /* opt */ false, | {"txid", RPCArg::Type::STR_HEX, /* opt */ false, | ||||
/* default_val */ "", | /* default_val */ "", | ||||
"The transaction id (must be in mempool)"}, | "The transaction id (must be in mempool)"}, | ||||
{"verbose", RPCArg::Type::BOOL, /* opt */ true, | {"verbose", RPCArg::Type::BOOL, /* opt */ true, | ||||
/* default_val */ "false", | /* default_val */ "false", | ||||
"True for a json object, false for array of " | "True for a json object, false for array of " | ||||
"transaction ids"}, | "transaction ids"}, | ||||
}} | }} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult (for verbose = false):\n" | "\nResult (for verbose = false):\n" | ||||
"[ (json array of strings)\n" | "[ (json array of strings)\n" | ||||
" \"transactionid\" (string) The transaction id of an " | " \"transactionid\" (string) The transaction id of an " | ||||
"in-mempool descendant transaction\n" | "in-mempool descendant transaction\n" | ||||
" ,...\n" | " ,...\n" | ||||
"]\n" | "]\n" | ||||
"\nResult (for verbose = true):\n" | "\nResult (for verbose = true):\n" | ||||
"{ (json object)\n" | "{ (json object)\n" | ||||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() != 1) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
RPCHelpMan{"getmempoolentry", | RPCHelpMan{"getmempoolentry", | ||||
"\nReturns mempool data for given transaction\n", | "\nReturns mempool data for given transaction\n", | ||||
{ | { | ||||
{"txid", RPCArg::Type::STR_HEX, /* opt */ false, | {"txid", RPCArg::Type::STR_HEX, /* opt */ false, | ||||
/* default_val */ "", | /* default_val */ "", | ||||
"The transaction id (must be in mempool)"}, | "The transaction id (must be in mempool)"}, | ||||
}} | }} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"{ (json object)\n" + | "{ (json object)\n" + | ||||
EntryDescriptionString() + | EntryDescriptionString() + | ||||
"}\n" | "}\n" | ||||
"\nExamples:\n" + | "\nExamples:\n" + | ||||
HelpExampleCli("getmempoolentry", "\"mytxid\"") + | HelpExampleCli("getmempoolentry", "\"mytxid\"") + | ||||
HelpExampleRpc("getmempoolentry", "\"mytxid\"")); | HelpExampleRpc("getmempoolentry", "\"mytxid\"")); | ||||
} | } | ||||
Show All 20 Lines | if (request.fHelp || request.params.size() != 1) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
RPCHelpMan{"getblockhash", | RPCHelpMan{"getblockhash", | ||||
"\nReturns hash of block in best-block-chain at height " | "\nReturns hash of block in best-block-chain at height " | ||||
"provided.\n", | "provided.\n", | ||||
{ | { | ||||
{"height", RPCArg::Type::NUM, /* opt */ false, | {"height", RPCArg::Type::NUM, /* opt */ false, | ||||
/* default_val */ "", "The height index"}, | /* default_val */ "", "The height index"}, | ||||
}} | }} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"\"hash\" (string) The block hash\n" | "\"hash\" (string) The block hash\n" | ||||
"\nExamples:\n" + | "\nExamples:\n" + | ||||
HelpExampleCli("getblockhash", "1000") + | HelpExampleCli("getblockhash", "1000") + | ||||
HelpExampleRpc("getblockhash", "1000")); | HelpExampleRpc("getblockhash", "1000")); | ||||
} | } | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
Show All 20 Lines | if (request.fHelp || request.params.size() < 1 || | ||||
"about blockheader <hash>.\n", | "about blockheader <hash>.\n", | ||||
{ | { | ||||
{"blockhash", RPCArg::Type::STR_HEX, /* opt */ false, | {"blockhash", RPCArg::Type::STR_HEX, /* opt */ false, | ||||
/* default_val */ "", "The block hash"}, | /* default_val */ "", "The block hash"}, | ||||
{"verbose", RPCArg::Type::BOOL, /* opt */ true, | {"verbose", RPCArg::Type::BOOL, /* opt */ true, | ||||
/* default_val */ "true", | /* default_val */ "true", | ||||
"true for a json object, false for the hex-encoded data"}, | "true for a json object, false for the hex-encoded data"}, | ||||
}} | }} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult (for verbose = true):\n" | "\nResult (for verbose = true):\n" | ||||
"{\n" | "{\n" | ||||
" \"hash\" : \"hash\", (string) the block hash (same as " | " \"hash\" : \"hash\", (string) the block hash (same as " | ||||
"provided)\n" | "provided)\n" | ||||
" \"confirmations\" : n, (numeric) The number of confirmations, " | " \"confirmations\" : n, (numeric) The number of confirmations, " | ||||
"or -1 if the block is not on the main chain\n" | "or -1 if the block is not on the main chain\n" | ||||
" \"height\" : n, (numeric) The block height or index\n" | " \"height\" : n, (numeric) The block height or index\n" | ||||
" \"version\" : n, (numeric) The block version\n" | " \"version\" : n, (numeric) The block version\n" | ||||
▲ Show 20 Lines • Show All 91 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() < 1 || | ||||
{ | { | ||||
{"blockhash", RPCArg::Type::STR_HEX, /* opt */ false, | {"blockhash", RPCArg::Type::STR_HEX, /* opt */ false, | ||||
/* default_val */ "", "The block hash"}, | /* default_val */ "", "The block hash"}, | ||||
{"verbosity", RPCArg::Type::NUM, /* opt */ true, | {"verbosity", RPCArg::Type::NUM, /* opt */ true, | ||||
/* default_val */ "1", | /* default_val */ "1", | ||||
"0 for hex-encoded data, 1 for a json object, and 2 for " | "0 for hex-encoded data, 1 for a json object, and 2 for " | ||||
"json object with transaction data"}, | "json object with transaction data"}, | ||||
}} | }} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult (for verbosity = 0):\n" | "\nResult (for verbosity = 0):\n" | ||||
"\"data\" (string) A string that is serialized, " | "\"data\" (string) A string that is serialized, " | ||||
"hex-encoded data for block 'hash'.\n" | "hex-encoded data for block 'hash'.\n" | ||||
"\nResult (for verbosity = 1):\n" | "\nResult (for verbosity = 1):\n" | ||||
"{\n" | "{\n" | ||||
" \"hash\" : \"hash\", (string) The block hash (same as " | " \"hash\" : \"hash\", (string) The block hash (same as " | ||||
"provided)\n" | "provided)\n" | ||||
" \"confirmations\" : n, (numeric) The number of confirmations, " | " \"confirmations\" : n, (numeric) The number of confirmations, " | ||||
▲ Show 20 Lines • Show All 158 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() != 1) { | ||||
{ | { | ||||
{"height", RPCArg::Type::NUM, /* opt */ false, | {"height", RPCArg::Type::NUM, /* opt */ false, | ||||
/* default_val */ "", | /* default_val */ "", | ||||
"The block height to prune up to. May be set to a " | "The block height to prune up to. May be set to a " | ||||
"discrete height, or a unix timestamp\n" | "discrete height, or a unix timestamp\n" | ||||
" to prune blocks whose block time is at " | " to prune blocks whose block time is at " | ||||
"least 2 hours older than the provided timestamp."}, | "least 2 hours older than the provided timestamp."}, | ||||
}} | }} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"n (numeric) Height of the last block pruned.\n" | "n (numeric) Height of the last block pruned.\n" | ||||
"\nExamples:\n" + | "\nExamples:\n" + | ||||
HelpExampleCli("pruneblockchain", "1000") + | HelpExampleCli("pruneblockchain", "1000") + | ||||
HelpExampleRpc("pruneblockchain", "1000")); | HelpExampleRpc("pruneblockchain", "1000")); | ||||
} | } | ||||
if (!fPruneMode) { | if (!fPruneMode) { | ||||
▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | static UniValue gettxoutsetinfo(const Config &config, | ||||
const JSONRPCRequest &request) { | 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{"gettxoutsetinfo", | RPCHelpMan{"gettxoutsetinfo", | ||||
"\nReturns statistics about the unspent transaction " | "\nReturns statistics about the unspent transaction " | ||||
"output set.\n" | "output set.\n" | ||||
"Note this call may take some time.\n", | "Note this call may take some time.\n", | ||||
{}} | {}} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\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 best block hash hex\n" | " \"bestblock\": \"hex\", (string) the best block hash hex\n" | ||||
" \"transactions\": n, (numeric) The number of transactions\n" | " \"transactions\": n, (numeric) The number of transactions\n" | ||||
" \"txouts\": n, (numeric) The number of output " | " \"txouts\": n, (numeric) The number of output " | ||||
"transactions\n" | "transactions\n" | ||||
" \"bogosize\": n, (numeric) A database-independent " | " \"bogosize\": n, (numeric) A database-independent " | ||||
Show All 39 Lines | if (request.fHelp || request.params.size() < 2 || | ||||
/* default_val */ "", "The transaction id"}, | /* default_val */ "", "The transaction id"}, | ||||
{"n", RPCArg::Type::NUM, /* opt */ false, | {"n", RPCArg::Type::NUM, /* opt */ false, | ||||
/* default_val */ "", "vout number"}, | /* default_val */ "", "vout number"}, | ||||
{"include_mempool", RPCArg::Type::BOOL, /* opt */ true, | {"include_mempool", RPCArg::Type::BOOL, /* opt */ true, | ||||
/* default_val */ "true", | /* default_val */ "true", | ||||
"Whether to include the mempool. Note that an unspent " | "Whether to include the mempool. Note that an unspent " | ||||
"output that is spent in the mempool won't appear."}, | "output that is spent in the mempool won't appear."}, | ||||
}} | }} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"{\n" | "{\n" | ||||
" \"bestblock\" : \"hash\", (string) the block hash\n" | " \"bestblock\" : \"hash\", (string) the block hash\n" | ||||
" \"confirmations\" : n, (numeric) The number of " | " \"confirmations\" : n, (numeric) The number of " | ||||
"confirmations\n" | "confirmations\n" | ||||
" \"value\" : x.xxx, (numeric) The transaction value " | " \"value\" : x.xxx, (numeric) The transaction value " | ||||
"in " + | "in " + | ||||
CURRENCY_UNIT + | CURRENCY_UNIT + | ||||
▲ Show 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() > 2) { | ||||
{ | { | ||||
{"checklevel", RPCArg::Type::NUM, /* opt */ true, | {"checklevel", RPCArg::Type::NUM, /* opt */ true, | ||||
/* default_val */ strprintf("%d, range=0-4", nCheckLevel), | /* default_val */ strprintf("%d, range=0-4", nCheckLevel), | ||||
"How thorough the block verification is."}, | "How thorough the block verification is."}, | ||||
{"nblocks", RPCArg::Type::NUM, /* opt */ true, | {"nblocks", RPCArg::Type::NUM, /* opt */ true, | ||||
/* default_val */ strprintf("%d, 0=all", nCheckDepth), | /* default_val */ strprintf("%d, 0=all", nCheckDepth), | ||||
"The number of blocks to check."}, | "The number of blocks to check."}, | ||||
}} | }} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"true|false (boolean) Verified or not\n" | "true|false (boolean) Verified or not\n" | ||||
"\nExamples:\n" + | "\nExamples:\n" + | ||||
HelpExampleCli("verifychain", "") + | HelpExampleCli("verifychain", "") + | ||||
HelpExampleRpc("verifychain", "")); | HelpExampleRpc("verifychain", "")); | ||||
} | } | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
▲ Show 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | |||||
UniValue getblockchaininfo(const Config &config, | UniValue getblockchaininfo(const Config &config, | ||||
const JSONRPCRequest &request) { | 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 " | "Returns an object containing various state info " | ||||
"regarding blockchain processing.\n", | "regarding blockchain processing.\n", | ||||
{}} | {}} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"{\n" | "{\n" | ||||
" \"chain\": \"xxxx\", (string) current network name " | " \"chain\": \"xxxx\", (string) current network name " | ||||
"as defined in BIP70 (main, test, regtest)\n" | "as defined in BIP70 (main, test, regtest)\n" | ||||
" \"blocks\": xxxxxx, (numeric) the current number of " | " \"blocks\": xxxxxx, (numeric) the current number of " | ||||
"blocks processed in the server\n" | "blocks processed in the server\n" | ||||
" \"headers\": xxxxxx, (numeric) the current number of " | " \"headers\": xxxxxx, (numeric) the current number of " | ||||
"headers we have validated\n" | "headers we have validated\n" | ||||
▲ Show 20 Lines • Show All 130 Lines • ▼ Show 20 Lines | static UniValue getchaintips(const Config &config, | ||||
const JSONRPCRequest &request) { | 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{ | RPCHelpMan{ | ||||
"getchaintips", | "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", | ||||
{}} | {}} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"[\n" | "[\n" | ||||
" {\n" | " {\n" | ||||
" \"height\": xxxx, (numeric) height of the chain tip\n" | " \"height\": xxxx, (numeric) height of the chain tip\n" | ||||
" \"hash\": \"xxxx\", (string) block hash of the tip\n" | " \"hash\": \"xxxx\", (string) block hash of the tip\n" | ||||
" \"branchlen\": 0 (numeric) zero for main chain\n" | " \"branchlen\": 0 (numeric) zero for main chain\n" | ||||
" \"status\": \"active\" (string) \"active\" for the main " | " \"status\": \"active\" (string) \"active\" for the main " | ||||
"chain\n" | "chain\n" | ||||
▲ Show 20 Lines • Show All 125 Lines • ▼ Show 20 Lines | |||||
static UniValue getmempoolinfo(const Config &config, | static UniValue getmempoolinfo(const Config &config, | ||||
const JSONRPCRequest &request) { | 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 " | "\nReturns details on the active state of the TX memory " | ||||
"pool.\n", | "pool.\n", | ||||
{}} | {}} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"{\n" | "{\n" | ||||
" \"loaded\": true|false (boolean) True if the mempool is " | " \"loaded\": true|false (boolean) True if the mempool is " | ||||
"fully loaded\n" | "fully loaded\n" | ||||
" \"size\": xxxxx, (numeric) Current tx count\n" | " \"size\": xxxxx, (numeric) Current tx count\n" | ||||
" \"bytes\": xxxxx, (numeric) Transaction size.\n" | " \"bytes\": xxxxx, (numeric) Transaction size.\n" | ||||
" \"usage\": xxxxx, (numeric) Total memory usage for " | " \"usage\": xxxxx, (numeric) Total memory usage for " | ||||
"the mempool\n" | "the mempool\n" | ||||
Show All 25 Lines | if (request.fHelp || request.params.size() != 1) { | ||||
"of an earlier one.\n" | "of an earlier one.\n" | ||||
"\nThe effects of preciousblock are not retained across " | "\nThe effects of preciousblock are not retained across " | ||||
"restarts.\n", | "restarts.\n", | ||||
{ | { | ||||
{"blockhash", RPCArg::Type::STR_HEX, /* opt */ false, | {"blockhash", RPCArg::Type::STR_HEX, /* opt */ false, | ||||
/* default_val */ "", | /* default_val */ "", | ||||
"the hash of the block to mark as precious"}, | "the hash of the block to mark as precious"}, | ||||
}} | }} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"\nExamples:\n" + | "\nExamples:\n" + | ||||
HelpExampleCli("preciousblock", "\"blockhash\"") + | HelpExampleCli("preciousblock", "\"blockhash\"") + | ||||
HelpExampleRpc("preciousblock", "\"blockhash\"")); | HelpExampleRpc("preciousblock", "\"blockhash\"")); | ||||
} | } | ||||
BlockHash hash(ParseHashV(request.params[0], "blockhash")); | BlockHash hash(ParseHashV(request.params[0], "blockhash")); | ||||
CBlockIndex *pblockindex; | CBlockIndex *pblockindex; | ||||
Show All 25 Lines | if (request.fHelp || request.params.size() != 1) { | ||||
"that does not contain this block is invalid. Used on a less\n" | "that does not contain this block is invalid. Used on a less\n" | ||||
"work chain, it can effectively PUTS YOU OUT OF CONSENSUS.\n" | "work chain, it can effectively PUTS YOU OUT OF CONSENSUS.\n" | ||||
"USE WITH CAUTION!\n", | "USE WITH CAUTION!\n", | ||||
{ | { | ||||
{"blockhash", RPCArg::Type::STR_HEX, /* opt */ false, | {"blockhash", RPCArg::Type::STR_HEX, /* opt */ false, | ||||
/* default_val */ "", | /* default_val */ "", | ||||
"the hash of the block to mark as invalid"}, | "the hash of the block to mark as invalid"}, | ||||
}} | }} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"\nExamples:\n" + | "\nExamples:\n" + | ||||
HelpExampleCli("finalizeblock", "\"blockhash\"") + | HelpExampleCli("finalizeblock", "\"blockhash\"") + | ||||
HelpExampleRpc("finalizeblock", "\"blockhash\"")); | HelpExampleRpc("finalizeblock", "\"blockhash\"")); | ||||
} | } | ||||
std::string strHash = request.params[0].get_str(); | std::string strHash = request.params[0].get_str(); | ||||
BlockHash hash(uint256S(strHash)); | BlockHash hash(uint256S(strHash)); | ||||
Show All 27 Lines | if (request.fHelp || request.params.size() != 1) { | ||||
RPCHelpMan{"invalidateblock", | RPCHelpMan{"invalidateblock", | ||||
"\nPermanently marks a block as invalid, as if it " | "\nPermanently marks a block as invalid, as if it " | ||||
"violated a consensus rule.\n", | "violated a consensus rule.\n", | ||||
{ | { | ||||
{"blockhash", RPCArg::Type::STR_HEX, /* opt */ false, | {"blockhash", RPCArg::Type::STR_HEX, /* opt */ false, | ||||
/* default_val */ "", | /* default_val */ "", | ||||
"the hash of the block to mark as invalid"}, | "the hash of the block to mark as invalid"}, | ||||
}} | }} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"\nExamples:\n" + | "\nExamples:\n" + | ||||
HelpExampleCli("invalidateblock", "\"blockhash\"") + | HelpExampleCli("invalidateblock", "\"blockhash\"") + | ||||
HelpExampleRpc("invalidateblock", "\"blockhash\"")); | HelpExampleRpc("invalidateblock", "\"blockhash\"")); | ||||
} | } | ||||
const BlockHash hash(ParseHashV(request.params[0], "blockhash")); | const BlockHash hash(ParseHashV(request.params[0], "blockhash")); | ||||
CValidationState state; | CValidationState state; | ||||
Show All 24 Lines | if (request.fHelp || request.params.size() != 1) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
RPCHelpMan{ | RPCHelpMan{ | ||||
"parkblock", | "parkblock", | ||||
"\nMarks a block as parked.\n", | "\nMarks a block as parked.\n", | ||||
{ | { | ||||
{"blockhash", RPCArg::Type::STR_HEX, /* opt */ false, | {"blockhash", RPCArg::Type::STR_HEX, /* opt */ false, | ||||
/* default_val */ "", "the hash of the block to park"}, | /* default_val */ "", "the hash of the block to park"}, | ||||
}} | }} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"\nExamples:\n" + | "\nExamples:\n" + | ||||
HelpExampleCli("parkblock", "\"blockhash\"") + | HelpExampleCli("parkblock", "\"blockhash\"") + | ||||
HelpExampleRpc("parkblock", "\"blockhash\"")); | HelpExampleRpc("parkblock", "\"blockhash\"")); | ||||
} | } | ||||
const std::string strHash = request.params[0].get_str(); | const std::string strHash = request.params[0].get_str(); | ||||
const BlockHash hash(uint256S(strHash)); | const BlockHash hash(uint256S(strHash)); | ||||
Show All 30 Lines | if (request.fHelp || request.params.size() != 1) { | ||||
"\nRemoves invalidity status of a block and its descendants, " | "\nRemoves invalidity status of a block and its descendants, " | ||||
"reconsider them for activation.\n" | "reconsider them for activation.\n" | ||||
"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, | {"blockhash", RPCArg::Type::STR_HEX, /* opt */ false, | ||||
/* default_val */ "", | /* default_val */ "", | ||||
"the hash of the block to reconsider"}, | "the hash of the block to reconsider"}, | ||||
}} | }} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"\nExamples:\n" + | "\nExamples:\n" + | ||||
HelpExampleCli("reconsiderblock", "\"blockhash\"") + | HelpExampleCli("reconsiderblock", "\"blockhash\"") + | ||||
HelpExampleRpc("reconsiderblock", "\"blockhash\"")); | HelpExampleRpc("reconsiderblock", "\"blockhash\"")); | ||||
} | } | ||||
const BlockHash hash(ParseHashV(request.params[0], "blockhash")); | const BlockHash hash(ParseHashV(request.params[0], "blockhash")); | ||||
Show All 24 Lines | if (request.fHelp || request.params.size() != 1) { | ||||
"unparkblock", | "unparkblock", | ||||
"\nRemoves parked status of a block and its descendants, " | "\nRemoves parked status of a block and its descendants, " | ||||
"reconsider them for activation.\n" | "reconsider them for activation.\n" | ||||
"This can be used to undo the effects of parkblock.\n", | "This can be used to undo the effects of parkblock.\n", | ||||
{ | { | ||||
{"blockhash", RPCArg::Type::STR_HEX, /* opt */ false, | {"blockhash", RPCArg::Type::STR_HEX, /* opt */ false, | ||||
/* default_val */ "", "the hash of the block to unpark"}, | /* default_val */ "", "the hash of the block to unpark"}, | ||||
}} | }} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"\nExamples:\n" + | "\nExamples:\n" + | ||||
HelpExampleCli("unparkblock", "\"blockhash\"") + | HelpExampleCli("unparkblock", "\"blockhash\"") + | ||||
HelpExampleRpc("unparkblock", "\"blockhash\"")); | HelpExampleRpc("unparkblock", "\"blockhash\"")); | ||||
} | } | ||||
const std::string strHash = request.params[0].get_str(); | const std::string strHash = request.params[0].get_str(); | ||||
const BlockHash hash(uint256S(strHash)); | const BlockHash hash(uint256S(strHash)); | ||||
Show All 28 Lines | if (request.fHelp || request.params.size() > 2) { | ||||
{ | { | ||||
{"nblocks", RPCArg::Type::NUM, /* opt */ true, | {"nblocks", RPCArg::Type::NUM, /* opt */ true, | ||||
/* default_val */ "one month", | /* default_val */ "one month", | ||||
"Size of the window in number of blocks"}, | "Size of the window in number of blocks"}, | ||||
{"blockhash", RPCArg::Type::STR_HEX, /* opt */ true, | {"blockhash", RPCArg::Type::STR_HEX, /* opt */ true, | ||||
/* default_val */ "", | /* default_val */ "", | ||||
"The hash of the block that ends the window."}, | "The hash of the block that ends the window."}, | ||||
}} | }} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"{\n" | "{\n" | ||||
" \"time\": xxxxx, (numeric) The " | " \"time\": xxxxx, (numeric) The " | ||||
"timestamp for the final block in the window in UNIX format.\n" | "timestamp for the final block in the window in UNIX format.\n" | ||||
" \"txcount\": xxxxx, (numeric) The total " | " \"txcount\": xxxxx, (numeric) The total " | ||||
"number of transactions in the chain up to that point.\n" | "number of transactions in the chain up to that point.\n" | ||||
" \"window_final_block_hash\": \"...\", (string) The hash of " | " \"window_final_block_hash\": \"...\", (string) The hash of " | ||||
"the final block in the window.\n" | "the final block in the window.\n" | ||||
▲ Show 20 Lines • Show All 131 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() < 1 || | ||||
{ | { | ||||
{"height", RPCArg::Type::STR, /* opt */ true, | {"height", RPCArg::Type::STR, /* opt */ true, | ||||
/* default_val */ "", "Selected statistic"}, | /* default_val */ "", "Selected statistic"}, | ||||
{"time", RPCArg::Type::STR, /* opt */ true, | {"time", RPCArg::Type::STR, /* opt */ true, | ||||
/* default_val */ "", "Selected statistic"}, | /* default_val */ "", "Selected statistic"}, | ||||
}, | }, | ||||
"stats"}, | "stats"}, | ||||
}} | }} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"{ (json object)\n" | "{ (json object)\n" | ||||
" \"avgfee\": x.xxx, (numeric) Average fee in the block\n" | " \"avgfee\": x.xxx, (numeric) Average fee in the block\n" | ||||
" \"avgfeerate\": x.xxx, (numeric) Average feerate (in " + | " \"avgfeerate\": x.xxx, (numeric) Average feerate (in " + | ||||
CURRENCY_UNIT + | CURRENCY_UNIT + | ||||
" per byte)\n" | " per byte)\n" | ||||
" \"avgtxsize\": xxxxx, (numeric) Average transaction size\n" | " \"avgtxsize\": xxxxx, (numeric) Average transaction size\n" | ||||
" \"blockhash\": xxxxx, (string) The block hash (to check " | " \"blockhash\": xxxxx, (string) The block hash (to check " | ||||
▲ Show 20 Lines • Show All 258 Lines • ▼ Show 20 Lines | |||||
static UniValue savemempool(const Config &config, | static UniValue savemempool(const Config &config, | ||||
const JSONRPCRequest &request) { | 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 " | "\nDumps the mempool to disk. It will fail until the " | ||||
"previous dump is fully loaded.\n", | "previous dump is fully loaded.\n", | ||||
{}} | {}} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nExamples:\n" + HelpExampleCli("savemempool", "") + | "\nExamples:\n" + HelpExampleCli("savemempool", "") + | ||||
HelpExampleRpc("savemempool", "")); | HelpExampleRpc("savemempool", "")); | ||||
} | } | ||||
if (!::g_mempool.IsLoaded()) { | if (!::g_mempool.IsLoaded()) { | ||||
throw JSONRPCError(RPC_MISC_ERROR, "The mempool was not loaded yet"); | throw JSONRPCError(RPC_MISC_ERROR, "The mempool was not loaded yet"); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 139 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() < 1 || | ||||
/* default_val */ "1000", | /* default_val */ "1000", | ||||
"Up to what child index HD chains should be " | "Up to what child index HD chains should be " | ||||
"explored"}, | "explored"}, | ||||
}, | }, | ||||
}, | }, | ||||
}, | }, | ||||
"[scanobjects,...]"}, | "[scanobjects,...]"}, | ||||
}} | }} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"{\n" | "{\n" | ||||
" \"unspents\": [\n" | " \"unspents\": [\n" | ||||
" {\n" | " {\n" | ||||
" \"txid\" : \"transactionid\", (string) The transaction " | " \"txid\" : \"transactionid\", (string) The transaction " | ||||
"id\n" | "id\n" | ||||
" \"vout\": n, (numeric) the vout value\n" | " \"vout\": n, (numeric) the vout value\n" | ||||
" \"scriptPubKey\" : \"script\", (string) the script key\n" | " \"scriptPubKey\" : \"script\", (string) the script key\n" | ||||
▲ Show 20 Lines • Show All 187 Lines • Show Last 20 Lines |