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

Commit

Permalink
add initialblockdownload and size_on_disk to getblockchaininfo rpc (#176
Browse files Browse the repository at this point in the history
)
  • Loading branch information
smogm authored and HenryYoung42 committed May 7, 2019
1 parent 783e859 commit c66ff33
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
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

0 comments on commit c66ff33

Please sign in to comment.