Auto merge of #3639 - leto:size_on_disk, r=bitcartel
Port getblockchaininfo.size_on_disk from BTC master Closes #3630.
This commit is contained in:
commit
48b7dea5a8
|
@ -7,7 +7,7 @@ import sys; assert sys.version_info < (3,), ur"This script does not run under Py
|
|||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import assert_equal, initialize_chain_clean, \
|
||||
start_nodes, connect_nodes_bi, wait_and_assert_operationid_status
|
||||
start_nodes, connect_nodes_bi, wait_and_assert_operationid_status, assert_greater_than
|
||||
from test_framework.authproxy import JSONRPCException
|
||||
|
||||
from decimal import Decimal
|
||||
|
@ -148,6 +148,10 @@ class WalletOverwinterTxTest (BitcoinTestFramework):
|
|||
self.nodes[0].generate(1)
|
||||
self.sync_all()
|
||||
bci = self.nodes[0].getblockchaininfo()
|
||||
|
||||
# size_on_disk should be > 0
|
||||
assert_greater_than(bci['size_on_disk'], 0)
|
||||
|
||||
assert_equal(bci['consensus']['chaintip'], '5ba81b19')
|
||||
assert_equal(bci['consensus']['nextblock'], '5ba81b19')
|
||||
assert_equal(bci['upgrades']['5ba81b19']['status'], 'active')
|
||||
|
|
|
@ -580,6 +580,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);
|
||||
|
||||
|
|
|
@ -714,6 +714,7 @@ void NetworkUpgradeDescPushBack(
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
UniValue getblockchaininfo(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (fHelp || params.size() != 0)
|
||||
|
@ -731,6 +732,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"
|
||||
|
@ -774,6 +776,7 @@ UniValue getblockchaininfo(const UniValue& params, bool fHelp)
|
|||
obj.push_back(Pair("verificationprogress", Checkpoints::GuessVerificationProgress(Params().Checkpoints(), chainActive.Tip())));
|
||||
obj.push_back(Pair("chainwork", chainActive.Tip()->nChainWork.GetHex()));
|
||||
obj.push_back(Pair("pruned", fPruneMode));
|
||||
obj.push_back(Pair("size_on_disk", CalculateCurrentUsage()));
|
||||
|
||||
SproutMerkleTree tree;
|
||||
pcoinsTip->GetSproutAnchorAt(pcoinsTip->GetBestAnchor(SPROUT), tree);
|
||||
|
|
Loading…
Reference in New Issue