Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/blockchain.cpp
Show All 18 Lines | |||||
#include "rpc/server.h" | #include "rpc/server.h" | ||||
#include "streams.h" | #include "streams.h" | ||||
#include "sync.h" | #include "sync.h" | ||||
#include "txdb.h" | #include "txdb.h" | ||||
#include "txmempool.h" | #include "txmempool.h" | ||||
#include "util.h" | #include "util.h" | ||||
#include "utilstrencodings.h" | #include "utilstrencodings.h" | ||||
#include "validation.h" | #include "validation.h" | ||||
#include "warnings.h" | |||||
#include <boost/thread/thread.hpp> // boost::thread::interrupt | #include <boost/thread/thread.hpp> // boost::thread::interrupt | ||||
#include <condition_variable> | #include <condition_variable> | ||||
#include <cstdint> | #include <cstdint> | ||||
#include <mutex> | #include <mutex> | ||||
struct CUpdatedBlock { | struct CUpdatedBlock { | ||||
▲ Show 20 Lines • Show All 1,194 Lines • ▼ Show 20 Lines | 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" | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"{\n" | "{\n" | ||||
" \"chain\": \"xxxx\", (string) current network name as " | " \"chain\": \"xxxx\", (string) current network name " | ||||
jasonbcox: If you did these indents yourself, please revert them. If it was the linter, leave as-is. | |||||
nakihitoAuthorUnsubmitted Done Inline ActionsA similar change was requested by Fabien in a different diff (see https://reviews.bitcoinabc.org/D2711?id=7751#inline-16561). nakihito: A similar change was requested by Fabien in a different diff (see https://reviews.bitcoinabc. | |||||
FabienUnsubmitted Done Inline ActionsThis is a good idea to fix it, but this time it's not part of the original PR (it was the last time). Fabien: This is a good idea to fix it, but this time it's not part of the original PR (it was the last… | |||||
nakihitoAuthorUnsubmitted Done Inline ActionsSeparated the indentation changes to here: https://reviews.bitcoinabc.org/D2737 nakihito: Separated the indentation changes to here: https://reviews.bitcoinabc.org/D2737 | |||||
"as " | |||||
"defined in BIP70 (main, test, regtest)\n" | "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" | ||||
" \"bestblockhash\": \"...\", (string) the hash of the currently " | " \"bestblockhash\": \"...\", (string) the hash of the " | ||||
"currently " | |||||
"best block\n" | "best block\n" | ||||
" \"difficulty\": xxxxxx, (numeric) the current difficulty\n" | " \"difficulty\": xxxxxx, (numeric) the current " | ||||
"difficulty\n" | |||||
" \"mediantime\": xxxxxx, (numeric) median time for the " | " \"mediantime\": xxxxxx, (numeric) median time for the " | ||||
"current best block\n" | "current best block\n" | ||||
" \"verificationprogress\": xxxx, (numeric) estimate of " | " \"verificationprogress\": xxxx, (numeric) estimate of " | ||||
"verification progress [0..1]\n" | "verification progress [0..1]\n" | ||||
" \"chainwork\": \"xxxx\" (string) total amount of work in " | " \"chainwork\": \"xxxx\" (string) total amount of work " | ||||
"in " | |||||
"active chain, in hexadecimal\n" | "active chain, in hexadecimal\n" | ||||
" \"pruned\": xx, (boolean) if the blocks are subject " | " \"pruned\": xx, (boolean) if the blocks are " | ||||
"subject " | |||||
"to pruning\n" | "to pruning\n" | ||||
" \"pruneheight\": xxxxxx, (numeric) lowest-height complete " | " \"pruneheight\": xxxxxx, (numeric) lowest-height " | ||||
"complete " | |||||
"block stored\n" | "block stored\n" | ||||
" \"softforks\": [ (array) status of softforks in " | " \"softforks\": [ (array) status of softforks in " | ||||
"progress\n" | "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" | ||||
" }, ...\n" | " }, ...\n" | ||||
" ]\n" | " ]\n" | ||||
" \"warnings\" : \"...\", (string) any network and " | |||||
"blockchain warnings.\n" | |||||
"}\n" | "}\n" | ||||
"\nExamples:\n" + | "\nExamples:\n" + | ||||
HelpExampleCli("getblockchaininfo", "") + | HelpExampleCli("getblockchaininfo", "") + | ||||
HelpExampleRpc("getblockchaininfo", "")); | HelpExampleRpc("getblockchaininfo", "")); | ||||
} | } | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
Show All 23 Lines | UniValue getblockchaininfo(const Config &config, | ||||
if (fPruneMode) { | if (fPruneMode) { | ||||
CBlockIndex *block = chainActive.Tip(); | CBlockIndex *block = chainActive.Tip(); | ||||
while (block && block->pprev && block->pprev->nStatus.hasData()) { | while (block && block->pprev && block->pprev->nStatus.hasData()) { | ||||
block = block->pprev; | block = block->pprev; | ||||
} | } | ||||
obj.pushKV("pruneheight", block->nHeight); | obj.pushKV("pruneheight", block->nHeight); | ||||
} | } | ||||
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 { | ||||
// Make sure that unequal blocks with the same height do not compare | // Make sure that unequal blocks with the same height do not compare | ||||
// equal. Use the pointers themselves to make a distinction. | // equal. Use the pointers themselves to make a distinction. | ||||
▲ Show 20 Lines • Show All 546 Lines • Show Last 20 Lines |
If you did these indents yourself, please revert them. If it was the linter, leave as-is.