Skip to content
This repository has been archived by the owner on Feb 1, 2021. It is now read-only.

add initialblockdownload and size_on_disk to getblockchaininfo rpc #176

Merged
merged 1 commit into from
May 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,9 @@ bool CheckBlock(const CBlock &block, CValidationState &state, bool fCheckPOW = t
/** Context-dependent validity checks */
bool ContextualCheckBlock(const CBlock &block, CValidationState &state, CBlockIndex *pindexPrev);

/* Calculate the amount of disk space the block & undo files currently use */
uint64_t CalculateCurrentUsage();

extern std::set<CBlockIndex *, CBlockIndexWorkComparator> setBlockIndexCandidates;

class CBlockFileInfo
Expand Down
5 changes: 5 additions & 0 deletions src/rpc/rpcblockchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,10 @@ UniValue getblockchaininfo(const UniValue &params, bool fHelp)
" \"difficulty\": xxxxxx, (numeric) the current difficulty\n"
" \"mediantime\": xxxxxx, (numeric) median time for the current best block\n"
" \"verificationprogress\": xxxx, (numeric) estimate of verification progress [0..1]\n"
" \"initialblockdownload\": xxxx, (bool) (debug information) estimate of whether this node is in Initial "
"Block Download mode.\n"
" \"chainwork\": \"xxxx\" (string) total amount of work in active chain, in hexadecimal\n"
" \"size_on_disk\": xxxxxx, (numeric) the estimated size of the block and undo files on disk\n"
" \"pruned\": xx, (boolean) if the blocks are subject to pruning\n"
" \"pruneheight\": xxxxxx, (numeric) heighest block available\n"
" \"softforks\": [ (array) status of softforks in progress\n"
Expand Down Expand Up @@ -787,7 +790,9 @@ UniValue getblockchaininfo(const UniValue &params, bool fHelp)
obj.push_back(Pair("verificationprogress",
Checkpoints::GuessVerificationProgress(pnetMan->getActivePaymentNetwork()->Checkpoints(),
pnetMan->getChainActive()->chainActive.Tip())));
obj.push_back(Pair("initialblockdownload", pnetMan->getChainActive()->IsInitialBlockDownload()));
obj.push_back(Pair("chainwork", pnetMan->getChainActive()->chainActive.Tip()->nChainWork.GetHex()));
obj.push_back(Pair("size_on_disk", CalculateCurrentUsage()));

const Consensus::Params &consensusParams = pnetMan->getActivePaymentNetwork()->GetConsensus();
CBlockIndex *tip = pnetMan->getChainActive()->chainActive.Tip();
Expand Down