Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/blockchain.cpp
Show First 20 Lines • Show All 1,251 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( | ||||
"getblockchaininfo\n" | "getblockchaininfo\n" | ||||
"Returns an object containing various state info regarding " | "Returns an object containing various state info regarding " | ||||
"blockchain processing.\n" | "blockchain processing.\n" | ||||
"DEPRECATION WARNING: The 'softforks' output has been deprecated " | |||||
"and will be\n" | |||||
"removed v0.20. For the time being it will only be shown here when " | |||||
"bitcoind\n" | |||||
"is started with -deprecatedrpc=getblockchaininfo.\n" | |||||
"\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 All 14 Lines | if (request.fHelp || request.params.size() != 0) { | ||||
" \"pruned\": xx, (boolean) if the blocks are " | " \"pruned\": xx, (boolean) if the blocks are " | ||||
"subject to pruning\n" | "subject to pruning\n" | ||||
" \"pruneheight\": xxxxxx, (numeric) lowest-height " | " \"pruneheight\": xxxxxx, (numeric) lowest-height " | ||||
"complete block stored (only present if pruning is enabled)\n" | "complete block stored (only present if pruning is enabled)\n" | ||||
" \"automatic_pruning\": xx, (boolean) whether automatic " | " \"automatic_pruning\": xx, (boolean) whether automatic " | ||||
"pruning is enabled (only present if pruning is enabled)\n" | "pruning is enabled (only present if pruning is enabled)\n" | ||||
" \"prune_target_size\": xxxxxx, (numeric) the target size " | " \"prune_target_size\": xxxxxx, (numeric) the target size " | ||||
"used by pruning (only present if automatic pruning is enabled)\n" | "used by pruning (only present if automatic pruning is enabled)\n" | ||||
" \"softforks\": [ (array) status of softforks in " | " \"softforks\": [ (array) DEPRECATED: status of " | ||||
"progress\n" | "softforks in progress\n" | ||||
" {\n" | " {\n" | ||||
" \"id\": \"xxxx\", (string) name of softfork\n" | " \"id\": \"xxxx\", (string) name of softfork\n" | ||||
" \"version\": xx, (numeric) block version\n" | " \"version\": xx, (numeric) block version\n" | ||||
" \"reject\": { (object) progress toward " | " \"reject\": { (object) progress toward " | ||||
"rejecting pre-softfork blocks\n" | "rejecting pre-softfork blocks\n" | ||||
" \"status\": xx, (boolean) true if threshold " | " \"status\": xx, (boolean) true if threshold " | ||||
"reached\n" | "reached\n" | ||||
" },\n" | " },\n" | ||||
Show All 36 Lines | if (fPruneMode) { | ||||
// if 0, execution bypasses the whole if block. | // if 0, execution bypasses the whole if block. | ||||
bool automatic_pruning = (gArgs.GetArg("-prune", 0) != 1); | bool automatic_pruning = (gArgs.GetArg("-prune", 0) != 1); | ||||
obj.pushKV("automatic_pruning", automatic_pruning); | obj.pushKV("automatic_pruning", automatic_pruning); | ||||
if (automatic_pruning) { | if (automatic_pruning) { | ||||
obj.pushKV("prune_target_size", nPruneTarget); | obj.pushKV("prune_target_size", nPruneTarget); | ||||
} | } | ||||
} | } | ||||
if (IsDeprecatedRPCEnabled(gArgs, "getblockchaininfo")) { | |||||
const Consensus::Params &consensusParams = | const Consensus::Params &consensusParams = | ||||
config.GetChainParams().GetConsensus(); | config.GetChainParams().GetConsensus(); | ||||
UniValue softforks(UniValue::VARR); | UniValue softforks(UniValue::VARR); | ||||
softforks.push_back(SoftForkDesc("bip34", 2, tip, consensusParams)); | softforks.push_back(SoftForkDesc("bip34", 2, tip, consensusParams)); | ||||
softforks.push_back(SoftForkDesc("bip66", 3, tip, consensusParams)); | softforks.push_back(SoftForkDesc("bip66", 3, tip, consensusParams)); | ||||
softforks.push_back(SoftForkDesc("bip65", 4, tip, consensusParams)); | softforks.push_back(SoftForkDesc("bip65", 4, tip, consensusParams)); | ||||
softforks.push_back(SoftForkDesc("csv", 5, tip, consensusParams)); | softforks.push_back(SoftForkDesc("csv", 5, tip, consensusParams)); | ||||
obj.pushKV("softforks", softforks); | obj.pushKV("softforks", softforks); | ||||
} | |||||
obj.pushKV("warnings", GetWarnings("statusbar")); | obj.pushKV("warnings", GetWarnings("statusbar")); | ||||
return obj; | return obj; | ||||
} | } | ||||
/** Comparison function for sorting the getchaintips heads. */ | /** Comparison function for sorting the getchaintips heads. */ | ||||
struct CompareBlocksByHeight { | struct CompareBlocksByHeight { | ||||
bool operator()(const CBlockIndex *a, const CBlockIndex *b) const { | bool operator()(const CBlockIndex *a, const CBlockIndex *b) const { | ||||
▲ Show 20 Lines • Show All 572 Lines • Show Last 20 Lines |