Add size_on_disk to getblockchaininfo from BTC master

This commit is contained in:
Jonathan "Duke" Leto
2018-10-28 22:20:07 -07:00
parent 07abafda25
commit 42bf3ac4d8
2 changed files with 5 additions and 0 deletions

View File

@@ -916,6 +916,8 @@ extern CBlockTreeDB *pblocktree;
*/
int GetSpendHeight(const CCoinsViewCache& inputs);
uint64_t CalculateCurrentUsage();
/** Return a CMutableTransaction with contextual default values based on set of consensus rules at height */
CMutableTransaction CreateNewContextualCMutableTransaction(const Consensus::Params& consensusParams, int nHeight);

View File

@@ -1253,6 +1253,7 @@ void NetworkUpgradeDescPushBack(
}
}
UniValue getblockchaininfo(const UniValue& params, bool fHelp)
{
if (fHelp || params.size() != 0)
@@ -1270,6 +1271,7 @@ UniValue getblockchaininfo(const UniValue& params, bool fHelp)
" \"difficulty\": xxxxxx, (numeric) the current difficulty\n"
" \"verificationprogress\": xxxx, (numeric) estimate of verification progress [0..1]\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"
" \"commitments\": xxxxxx, (numeric) the current number of note commitments in the commitment tree\n"
" \"softforks\": [ (array) status of softforks in progress\n"
" {\n"
@@ -1319,6 +1321,7 @@ UniValue getblockchaininfo(const UniValue& params, bool fHelp)
obj.push_back(Pair("verificationprogress", progress));
obj.push_back(Pair("chainwork", chainActive.LastTip()->nChainWork.GetHex()));
obj.push_back(Pair("pruned", fPruneMode));
obj.push_back(Pair("size_on_disk", CalculateCurrentUsage()));
ZCIncrementalMerkleTree tree;
pcoinsTip->GetAnchorAt(pcoinsTip->GetBestAnchor(), tree);