Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/blockchain.cpp
Show First 20 Lines • Show All 223 Lines • ▼ Show 20 Lines | static UniValue waitfornewblock(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() > 1) { | if (request.fHelp || request.params.size() > 1) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"waitfornewblock", | "waitfornewblock", | ||||
"\nWaits for a specific new block and returns useful " | "\nWaits for a specific new block and returns useful " | ||||
"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, /* default */ "0", | ||||
/* default_val */ "0", | |||||
"Time in milliseconds to wait for a response. 0 indicates no " | "Time in milliseconds to wait for a response. 0 indicates no " | ||||
"timeout."}, | "timeout."}, | ||||
}, | }, | ||||
RPCResult{"{ (json object)\n" | RPCResult{"{ (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"}, | ||||
RPCExamples{HelpExampleCli("waitfornewblock", "1000") + | RPCExamples{HelpExampleCli("waitfornewblock", "1000") + | ||||
Show All 35 Lines | static UniValue waitforblock(const Config &config, | ||||
if (request.fHelp || request.params.size() < 1 || | if (request.fHelp || request.params.size() < 1 || | ||||
request.params.size() > 2) { | request.params.size() > 2) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"waitforblock", | "waitforblock", | ||||
"\nWaits for a specific new block and returns useful " | "\nWaits for a specific new block and returns useful " | ||||
"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", | ||||
{ | { | ||||
{"blockhash", RPCArg::Type::STR_HEX, /* opt */ false, | {"blockhash", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, | ||||
/* default_val */ "", "Block hash to wait for."}, | "Block hash to wait for."}, | ||||
{"timeout", RPCArg::Type::NUM, /* opt */ true, | {"timeout", RPCArg::Type::NUM, /* default */ "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."}, | ||||
}, | }, | ||||
RPCResult{"{ (json object)\n" | RPCResult{"{ (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"}, | ||||
RPCExamples{HelpExampleCli("waitforblock", | RPCExamples{HelpExampleCli("waitforblock", | ||||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | static UniValue waitforblockheight(const Config &config, | ||||
if (request.fHelp || request.params.size() < 1 || | if (request.fHelp || request.params.size() < 1 || | ||||
request.params.size() > 2) { | request.params.size() > 2) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"waitforblockheight", | "waitforblockheight", | ||||
"\nWaits for (at least) block height and returns the " | "\nWaits for (at least) block height and returns the " | ||||
"height and hash\nof the current tip.\n" | "height and hash\nof the current tip.\n" | ||||
"\nReturns the current block on timeout or exit.\n", | "\nReturns the current block on timeout or exit.\n", | ||||
{ | { | ||||
{"height", RPCArg::Type::NUM, /* opt */ false, | {"height", RPCArg::Type::NUM, RPCArg::Optional::NO, | ||||
/* default_val */ "", "Block height to wait for."}, | "Block height to wait for."}, | ||||
{"timeout", RPCArg::Type::NUM, /* opt */ true, | {"timeout", RPCArg::Type::NUM, /* default */ "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."}, | ||||
}, | }, | ||||
RPCResult{"{ (json object)\n" | RPCResult{"{ (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"}, | ||||
RPCExamples{HelpExampleCli("waitforblockheight", "\"100\", 1000") + | RPCExamples{HelpExampleCli("waitforblockheight", "\"100\", 1000") + | ||||
▲ Show 20 Lines • Show All 200 Lines • ▼ Show 20 Lines | static UniValue getrawmempool(const Config &config, | ||||
if (request.fHelp || request.params.size() > 1) { | if (request.fHelp || request.params.size() > 1) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"getrawmempool", | "getrawmempool", | ||||
"\nReturns all transaction ids in memory pool as a json " | "\nReturns all transaction ids in memory pool as a json " | ||||
"array of string transaction ids.\n" | "array of string transaction ids.\n" | ||||
"\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, /* default */ "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"}, | ||||
}, | }, | ||||
RPCResult{"for verbose = false", | RPCResult{"for verbose = false", | ||||
"[ (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" | ||||
Show All 21 Lines | static UniValue getmempoolancestors(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() < 1 || | if (request.fHelp || request.params.size() < 1 || | ||||
request.params.size() > 2) { | request.params.size() > 2) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"getmempoolancestors", | "getmempoolancestors", | ||||
"\nIf txid is in the mempool, returns all in-mempool " | "\nIf txid is in the mempool, returns all in-mempool " | ||||
"ancestors.\n", | "ancestors.\n", | ||||
{ | { | ||||
{"txid", RPCArg::Type::STR_HEX, /* opt */ false, | {"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, | ||||
/* 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, /* default */ "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"}, | ||||
}, | }, | ||||
{ | { | ||||
RPCResult{ | RPCResult{ | ||||
"for verbose = false", | "for verbose = false", | ||||
"[ (json array of strings)\n" | "[ (json array of strings)\n" | ||||
" \"transactionid\" (string) The transaction id " | " \"transactionid\" (string) The transaction id " | ||||
▲ Show 20 Lines • Show All 58 Lines • ▼ Show 20 Lines | static UniValue getmempooldescendants(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() < 1 || | if (request.fHelp || request.params.size() < 1 || | ||||
request.params.size() > 2) { | request.params.size() > 2) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"getmempooldescendants", | "getmempooldescendants", | ||||
"\nIf txid is in the mempool, returns all in-mempool " | "\nIf txid is in the mempool, returns all in-mempool " | ||||
"descendants.\n", | "descendants.\n", | ||||
{ | { | ||||
{"txid", RPCArg::Type::STR_HEX, /* opt */ false, | {"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, | ||||
/* 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, /* default */ "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"}, | ||||
}, | }, | ||||
{ | { | ||||
RPCResult{ | RPCResult{ | ||||
"for verbose = false", | "for verbose = false", | ||||
"[ (json array of strings)\n" | "[ (json array of strings)\n" | ||||
" \"transactionid\" (string) The transaction id " | " \"transactionid\" (string) The transaction id " | ||||
▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | |||||
static UniValue getmempoolentry(const Config &config, | static UniValue getmempoolentry(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() != 1) { | if (request.fHelp || request.params.size() != 1) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"getmempoolentry", | "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, RPCArg::Optional::NO, | ||||
/* default_val */ "", | |||||
"The transaction id (must be in mempool)"}, | "The transaction id (must be in mempool)"}, | ||||
}, | }, | ||||
RPCResult{"{ (json object)\n" + | RPCResult{"{ (json object)\n" + | ||||
EntryDescriptionString() + "}\n"}, | EntryDescriptionString() + "}\n"}, | ||||
RPCExamples{HelpExampleCli("getmempoolentry", "\"mytxid\"") + | RPCExamples{HelpExampleCli("getmempoolentry", "\"mytxid\"") + | ||||
HelpExampleRpc("getmempoolentry", "\"mytxid\"")}, | HelpExampleRpc("getmempoolentry", "\"mytxid\"")}, | ||||
} | } | ||||
.ToString()); | .ToString()); | ||||
Show All 18 Lines | |||||
static UniValue getblockhash(const Config &config, | static UniValue getblockhash(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() != 1) { | if (request.fHelp || request.params.size() != 1) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"getblockhash", | "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, RPCArg::Optional::NO, | ||||
/* default_val */ "", "The height index"}, | "The height index"}, | ||||
}, | }, | ||||
RPCResult{"\"hash\" (string) The block hash\n"}, | RPCResult{"\"hash\" (string) The block hash\n"}, | ||||
RPCExamples{HelpExampleCli("getblockhash", "1000") + | RPCExamples{HelpExampleCli("getblockhash", "1000") + | ||||
HelpExampleRpc("getblockhash", "1000")}, | HelpExampleRpc("getblockhash", "1000")}, | ||||
} | } | ||||
.ToString()); | .ToString()); | ||||
} | } | ||||
Show All 14 Lines | if (request.fHelp || request.params.size() < 1 || | ||||
request.params.size() > 2) { | request.params.size() > 2) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"getblockheader", | "getblockheader", | ||||
"\nIf verbose is false, returns a string that is " | "\nIf verbose is false, returns a string that is " | ||||
"serialized, hex-encoded data for blockheader 'hash'.\n" | "serialized, hex-encoded data for blockheader 'hash'.\n" | ||||
"If verbose is true, returns an Object with information " | "If verbose is true, returns an Object with information " | ||||
"about blockheader <hash>.\n", | "about blockheader <hash>.\n", | ||||
{ | { | ||||
{"blockhash", RPCArg::Type::STR_HEX, /* opt */ false, | {"blockhash", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, | ||||
/* default_val */ "", "The block hash"}, | "The block hash"}, | ||||
{"verbose", RPCArg::Type::BOOL, /* opt */ true, | {"verbose", RPCArg::Type::BOOL, /* default */ "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"}, | ||||
}, | }, | ||||
{ | { | ||||
RPCResult{ | RPCResult{ | ||||
"for verbose = true", | "for verbose = true", | ||||
"{\n" | "{\n" | ||||
" \"hash\" : \"hash\", (string) the block hash (same " | " \"hash\" : \"hash\", (string) the block hash (same " | ||||
"as provided)\n" | "as provided)\n" | ||||
▲ Show 20 Lines • Show All 94 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() < 1 || | ||||
"getblock", | "getblock", | ||||
"\nIf verbosity is 0 or false, returns a string that is " | "\nIf verbosity is 0 or false, returns a string that is " | ||||
"serialized, hex-encoded data for block 'hash'.\n" | "serialized, hex-encoded data for block 'hash'.\n" | ||||
"If verbosity is 1 or true, returns an Object with information " | "If verbosity is 1 or true, returns an Object with information " | ||||
"about block <hash>.\n" | "about block <hash>.\n" | ||||
"If verbosity is 2, returns an Object with information about " | "If verbosity is 2, returns an Object with information about " | ||||
"block <hash> and information about each transaction.\n", | "block <hash> and information about each transaction.\n", | ||||
{ | { | ||||
{"blockhash", RPCArg::Type::STR_HEX, /* opt */ false, | {"blockhash", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, | ||||
/* default_val */ "", "The block hash"}, | "The block hash"}, | ||||
{"verbosity", RPCArg::Type::NUM, /* opt */ true, | {"verbosity", RPCArg::Type::NUM, /* default */ "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"}, | ||||
}, | }, | ||||
{ | { | ||||
RPCResult{ | RPCResult{ | ||||
"for verbosity = 0", | "for verbosity = 0", | ||||
"\"data\" (string) A string that is " | "\"data\" (string) A string that is " | ||||
"serialized, hex-encoded data for block 'hash'.\n"}, | "serialized, hex-encoded data for block 'hash'.\n"}, | ||||
▲ Show 20 Lines • Show All 90 Lines • ▼ Show 20 Lines | |||||
static UniValue pruneblockchain(const Config &config, | static UniValue pruneblockchain(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() != 1) { | if (request.fHelp || request.params.size() != 1) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"pruneblockchain", | "pruneblockchain", | ||||
"", | "", | ||||
{ | { | ||||
{"height", RPCArg::Type::NUM, /* opt */ false, | {"height", RPCArg::Type::NUM, RPCArg::Optional::NO, | ||||
/* default_val */ "", | |||||
"The block height to prune up to. May be set to a discrete " | "The block height to prune up to. May be set to a discrete " | ||||
"height, or a unix timestamp\n" | "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."}, | ||||
}, | }, | ||||
RPCResult{"n (numeric) Height of the last block pruned.\n"}, | RPCResult{"n (numeric) Height of the last block pruned.\n"}, | ||||
RPCExamples{HelpExampleCli("pruneblockchain", "1000") + | RPCExamples{HelpExampleCli("pruneblockchain", "1000") + | ||||
HelpExampleRpc("pruneblockchain", "1000")}, | HelpExampleRpc("pruneblockchain", "1000")}, | ||||
▲ Show 20 Lines • Show All 101 Lines • ▼ Show 20 Lines | |||||
UniValue gettxout(const Config &config, const JSONRPCRequest &request) { | UniValue gettxout(const Config &config, const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() < 2 || | if (request.fHelp || request.params.size() < 2 || | ||||
request.params.size() > 3) { | request.params.size() > 3) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"gettxout", | "gettxout", | ||||
"\nReturns details about an unspent transaction output.\n", | "\nReturns details about an unspent transaction output.\n", | ||||
{ | { | ||||
{"txid", RPCArg::Type::STR_HEX, /* opt */ false, | {"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, | ||||
/* default_val */ "", "The transaction id"}, | "The transaction id"}, | ||||
{"n", RPCArg::Type::NUM, /* opt */ false, | {"n", RPCArg::Type::NUM, RPCArg::Optional::NO, "vout number"}, | ||||
/* default_val */ "", "vout number"}, | {"include_mempool", RPCArg::Type::BOOL, /* default */ "true", | ||||
{"include_mempool", RPCArg::Type::BOOL, /* opt */ 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."}, | ||||
}, | }, | ||||
RPCResult{ | RPCResult{ | ||||
"{\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" | ||||
▲ Show 20 Lines • Show All 72 Lines • ▼ Show 20 Lines | static UniValue verifychain(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
int nCheckLevel = gArgs.GetArg("-checklevel", DEFAULT_CHECKLEVEL); | int nCheckLevel = gArgs.GetArg("-checklevel", DEFAULT_CHECKLEVEL); | ||||
int nCheckDepth = gArgs.GetArg("-checkblocks", DEFAULT_CHECKBLOCKS); | int nCheckDepth = gArgs.GetArg("-checkblocks", DEFAULT_CHECKBLOCKS); | ||||
if (request.fHelp || request.params.size() > 2) { | if (request.fHelp || request.params.size() > 2) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"verifychain", | "verifychain", | ||||
"\nVerifies blockchain database.\n", | "\nVerifies blockchain database.\n", | ||||
{ | { | ||||
{"checklevel", RPCArg::Type::NUM, /* opt */ true, | {"checklevel", RPCArg::Type::NUM, | ||||
/* default_val */ strprintf("%d, range=0-4", nCheckLevel), | /* default */ 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, | ||||
/* default_val */ strprintf("%d, 0=all", nCheckDepth), | /* default */ strprintf("%d, 0=all", nCheckDepth), | ||||
"The number of blocks to check."}, | "The number of blocks to check."}, | ||||
}, | }, | ||||
RPCResult{"true|false (boolean) Verified or not\n"}, | RPCResult{"true|false (boolean) Verified or not\n"}, | ||||
RPCExamples{HelpExampleCli("verifychain", "") + | RPCExamples{HelpExampleCli("verifychain", "") + | ||||
HelpExampleRpc("verifychain", "")}, | HelpExampleRpc("verifychain", "")}, | ||||
} | } | ||||
.ToString()); | .ToString()); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 413 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() != 1) { | ||||
"preciousblock", | "preciousblock", | ||||
"\nTreats a block as if it were received before others " | "\nTreats a block as if it were received before others " | ||||
"with the same work.\n" | "with the same work.\n" | ||||
"\nA later preciousblock call can override the effect " | "\nA later preciousblock call can override the effect " | ||||
"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, RPCArg::Optional::NO, | ||||
/* default_val */ "", | |||||
"the hash of the block to mark as precious"}, | "the hash of the block to mark as precious"}, | ||||
}, | }, | ||||
RPCResults{}, | RPCResults{}, | ||||
RPCExamples{HelpExampleCli("preciousblock", "\"blockhash\"") + | RPCExamples{HelpExampleCli("preciousblock", "\"blockhash\"") + | ||||
HelpExampleRpc("preciousblock", "\"blockhash\"")}, | HelpExampleRpc("preciousblock", "\"blockhash\"")}, | ||||
} | } | ||||
.ToString()); | .ToString()); | ||||
} | } | ||||
Show All 23 Lines | UniValue finalizeblock(const Config &config, const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() != 1) { | if (request.fHelp || request.params.size() != 1) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"finalizeblock", | "finalizeblock", | ||||
"\nTreats a block as final. It cannot be reorged. Any chain\n" | "\nTreats a block as final. It cannot be reorged. Any chain\n" | ||||
"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, RPCArg::Optional::NO, | ||||
/* default_val */ "", | |||||
"the hash of the block to mark as invalid"}, | "the hash of the block to mark as invalid"}, | ||||
}, | }, | ||||
RPCResults{}, | RPCResults{}, | ||||
RPCExamples{HelpExampleCli("invalidateblock", "\"blockhash\"") + | RPCExamples{HelpExampleCli("invalidateblock", "\"blockhash\"") + | ||||
HelpExampleRpc("invalidateblock", "\"blockhash\"")}, | HelpExampleRpc("invalidateblock", "\"blockhash\"")}, | ||||
} | } | ||||
.ToString()); | .ToString()); | ||||
} | } | ||||
Show All 26 Lines | |||||
static UniValue invalidateblock(const Config &config, | static UniValue invalidateblock(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() != 1) { | if (request.fHelp || request.params.size() != 1) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"invalidateblock", | "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, RPCArg::Optional::NO, | ||||
/* default_val */ "", | |||||
"the hash of the block to mark as invalid"}, | "the hash of the block to mark as invalid"}, | ||||
}, | }, | ||||
RPCResults{}, | RPCResults{}, | ||||
RPCExamples{HelpExampleCli("invalidateblock", "\"blockhash\"") + | RPCExamples{HelpExampleCli("invalidateblock", "\"blockhash\"") + | ||||
HelpExampleRpc("invalidateblock", "\"blockhash\"")}, | HelpExampleRpc("invalidateblock", "\"blockhash\"")}, | ||||
} | } | ||||
.ToString()); | .ToString()); | ||||
} | } | ||||
Show All 23 Lines | |||||
} | } | ||||
UniValue parkblock(const Config &config, const JSONRPCRequest &request) { | UniValue parkblock(const Config &config, const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() != 1) { | if (request.fHelp || request.params.size() != 1) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(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, RPCArg::Optional::NO, | ||||
/* default_val */ "", "the hash of the block to park"}, | "the hash of the block to park"}, | ||||
}, | }, | ||||
RPCResults{}, | RPCResults{}, | ||||
RPCExamples{HelpExampleCli("parkblock", "\"blockhash\"") + | RPCExamples{HelpExampleCli("parkblock", "\"blockhash\"") + | ||||
HelpExampleRpc("parkblock", "\"blockhash\"")}, | HelpExampleRpc("parkblock", "\"blockhash\"")}, | ||||
} | } | ||||
.ToString()); | .ToString()); | ||||
} | } | ||||
Show All 27 Lines | static UniValue reconsiderblock(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() != 1) { | if (request.fHelp || request.params.size() != 1) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"reconsiderblock", | "reconsiderblock", | ||||
"\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, RPCArg::Optional::NO, | ||||
/* default_val */ "", "the hash of the block to reconsider"}, | "the hash of the block to reconsider"}, | ||||
}, | }, | ||||
RPCResults{}, | RPCResults{}, | ||||
RPCExamples{HelpExampleCli("reconsiderblock", "\"blockhash\"") + | RPCExamples{HelpExampleCli("reconsiderblock", "\"blockhash\"") + | ||||
HelpExampleRpc("reconsiderblock", "\"blockhash\"")}, | HelpExampleRpc("reconsiderblock", "\"blockhash\"")}, | ||||
} | } | ||||
.ToString()); | .ToString()); | ||||
} | } | ||||
Show All 22 Lines | |||||
UniValue unparkblock(const Config &config, const JSONRPCRequest &request) { | UniValue unparkblock(const Config &config, const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() != 1) { | if (request.fHelp || request.params.size() != 1) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"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, RPCArg::Optional::NO, | ||||
/* default_val */ "", "the hash of the block to unpark"}, | "the hash of the block to unpark"}, | ||||
}, | }, | ||||
RPCResults{}, | RPCResults{}, | ||||
RPCExamples{HelpExampleCli("unparkblock", "\"blockhash\"") + | RPCExamples{HelpExampleCli("unparkblock", "\"blockhash\"") + | ||||
HelpExampleRpc("unparkblock", "\"blockhash\"")}, | HelpExampleRpc("unparkblock", "\"blockhash\"")}, | ||||
} | } | ||||
.ToString()); | .ToString()); | ||||
} | } | ||||
Show All 23 Lines | |||||
static UniValue getchaintxstats(const Config &config, | static UniValue getchaintxstats(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() > 2) { | if (request.fHelp || request.params.size() > 2) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"getchaintxstats", | "getchaintxstats", | ||||
"\nCompute statistics about the total number and rate " | "\nCompute statistics about the total number and rate " | ||||
"of transactions in the chain.\n", | "of transactions in the chain.\n", | ||||
{ | { | ||||
{"nblocks", RPCArg::Type::NUM, /* opt */ true, | {"nblocks", RPCArg::Type::NUM, /* default */ "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, /* default */ "chain tip", | ||||
/* default_val */ "chain tip", | |||||
"The hash of the block that ends the window."}, | "The hash of the block that ends the window."}, | ||||
}, | }, | ||||
RPCResult{ | RPCResult{ | ||||
"{\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 " | " \"txcount\": xxxxx, (numeric) The " | ||||
"total number of transactions in the chain up to that point.\n" | "total number of transactions in the chain up to that point.\n" | ||||
▲ Show 20 Lines • Show All 115 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() < 1 || | ||||
CURRENCY_UNIT + | CURRENCY_UNIT + | ||||
".\n" | ".\n" | ||||
"It won't work for some heights with pruning.\n" | "It won't work for some heights with pruning.\n" | ||||
"It won't work without -txindex for utxo_size_inc, *fee or " | "It won't work without -txindex for utxo_size_inc, *fee or " | ||||
"*feerate stats.\n", | "*feerate stats.\n", | ||||
{ | { | ||||
{"hash_or_height", | {"hash_or_height", | ||||
RPCArg::Type::NUM, | RPCArg::Type::NUM, | ||||
/* opt */ false, | RPCArg::Optional::NO, | ||||
/* default_val */ "", | |||||
"The block hash or height of the target block", | "The block hash or height of the target block", | ||||
"", | "", | ||||
{"", "string or numeric"}}, | {"", "string or numeric"}}, | ||||
{"stats", | {"stats", | ||||
RPCArg::Type::ARR, | RPCArg::Type::ARR, | ||||
/* opt */ true, | /* default */ "all values", | ||||
/* default_val */ "all values", | |||||
"Values to plot (see result below)", | "Values to plot (see result below)", | ||||
{ | { | ||||
{"height", RPCArg::Type::STR, /* opt */ true, | {"height", RPCArg::Type::STR, RPCArg::Optional::OMITTED, | ||||
/* default_val */ "", "Selected statistic"}, | "Selected statistic"}, | ||||
{"time", RPCArg::Type::STR, /* opt */ true, | {"time", RPCArg::Type::STR, RPCArg::Optional::OMITTED, | ||||
/* default_val */ "", "Selected statistic"}, | "Selected statistic"}, | ||||
}, | }, | ||||
"stats"}, | "stats"}, | ||||
}, | }, | ||||
RPCResult{ | RPCResult{ | ||||
"{ (json object)\n" | "{ (json object)\n" | ||||
" \"avgfee\": x.xxx, (numeric) Average fee in the " | " \"avgfee\": x.xxx, (numeric) Average fee in the " | ||||
"block\n" | "block\n" | ||||
" \"avgfeerate\": x.xxx, (numeric) Average feerate (in " + | " \"avgfeerate\": x.xxx, (numeric) Average feerate (in " + | ||||
▲ Show 20 Lines • Show All 391 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() < 1 || | ||||
"ending in \"/*\" (unhardened), or \"/*'\" or \"/*h\" " | "ending in \"/*\" (unhardened), or \"/*'\" or \"/*h\" " | ||||
"(hardened) to specify all\n" | "(hardened) to specify all\n" | ||||
"unhardened or hardened child keys.\n" | "unhardened or hardened child keys.\n" | ||||
"In the latter case, a range needs to be specified by below if " | "In the latter case, a range needs to be specified by below if " | ||||
"different from 1000.\n" | "different from 1000.\n" | ||||
"For more information on output descriptors, see the " | "For more information on output descriptors, see the " | ||||
"documentation in the doc/descriptors.md file.\n", | "documentation in the doc/descriptors.md file.\n", | ||||
{ | { | ||||
{"action", RPCArg::Type::STR, /* opt */ false, | {"action", RPCArg::Type::STR, RPCArg::Optional::NO, | ||||
/* default_val */ "", | |||||
"The action to execute\n" | "The action to execute\n" | ||||
" \"start\" for " | " \"start\" for " | ||||
"starting a scan\n" | "starting a scan\n" | ||||
" \"abort\" for " | " \"abort\" for " | ||||
"aborting the current scan (returns true when abort was " | "aborting the current scan (returns true when abort was " | ||||
"successful)\n" | "successful)\n" | ||||
" \"status\" for " | " \"status\" for " | ||||
"progress report (in %) of the current scan"}, | "progress report (in %) of the current scan"}, | ||||
{"scanobjects", | {"scanobjects", | ||||
RPCArg::Type::ARR, | RPCArg::Type::ARR, | ||||
/* opt */ false, | RPCArg::Optional::NO, | ||||
/* default_val */ "", | |||||
"Array of scan objects\n" | "Array of scan objects\n" | ||||
" Every scan object is " | " Every scan object is " | ||||
"either a string descriptor or an object:", | "either a string descriptor or an object:", | ||||
{ | { | ||||
{"descriptor", RPCArg::Type::STR, /* opt */ true, | {"descriptor", RPCArg::Type::STR, | ||||
/* default_val */ "", "An output descriptor"}, | RPCArg::Optional::OMITTED, "An output descriptor"}, | ||||
{ | { | ||||
"", | "", | ||||
RPCArg::Type::OBJ, | RPCArg::Type::OBJ, | ||||
/* opt */ true, | RPCArg::Optional::OMITTED, | ||||
/* default_val */ "", | |||||
"An object with output descriptor and metadata", | "An object with output descriptor and metadata", | ||||
{ | { | ||||
{"desc", RPCArg::Type::STR, /* opt */ false, | {"desc", RPCArg::Type::STR, RPCArg::Optional::NO, | ||||
/* default_val */ "", "An output descriptor"}, | "An output descriptor"}, | ||||
{"range", RPCArg::Type::NUM, /* opt */ true, | {"range", RPCArg::Type::NUM, /* default */ "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,...]"}, | ||||
}, | }, | ||||
RPCResult{ | RPCResult{ | ||||
▲ Show 20 Lines • Show All 207 Lines • Show Last 20 Lines |