|
|
@ -1136,8 +1136,11 @@ UniValue getblockchaininfo(const JSONRPCRequest& request) |
|
|
|
" \"mediantime\": xxxxxx, (numeric) median time for the current best block\n" |
|
|
|
" \"mediantime\": xxxxxx, (numeric) median time for the current best block\n" |
|
|
|
" \"verificationprogress\": xxxx, (numeric) estimate of verification progress [0..1]\n" |
|
|
|
" \"verificationprogress\": xxxx, (numeric) estimate of verification progress [0..1]\n" |
|
|
|
" \"chainwork\": \"xxxx\" (string) total amount of work in active chain, in hexadecimal\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" |
|
|
|
" \"pruned\": xx, (boolean) if the blocks are subject to pruning\n" |
|
|
|
" \"pruneheight\": xxxxxx, (numeric) lowest-height complete block stored\n" |
|
|
|
" \"pruneheight\": xxxxxx, (numeric) lowest-height complete block stored (only present if pruning is enabled)\n" |
|
|
|
|
|
|
|
" \"automatic_pruning\": xx, (boolean) whether automatic pruning is enabled (only present if pruning is enabled)\n" |
|
|
|
|
|
|
|
" \"prune_target_size\": xxxxxx, (numeric) the target size used by pruning (only present if automatic pruning is enabled)\n" |
|
|
|
" \"softforks\": [ (array) status of softforks in progress\n" |
|
|
|
" \"softforks\": [ (array) status of softforks in progress\n" |
|
|
|
" {\n" |
|
|
|
" {\n" |
|
|
|
" \"id\": \"xxxx\", (string) name of softfork\n" |
|
|
|
" \"id\": \"xxxx\", (string) name of softfork\n" |
|
|
@ -1181,7 +1184,24 @@ UniValue getblockchaininfo(const JSONRPCRequest& request) |
|
|
|
obj.push_back(Pair("mediantime", (int64_t)chainActive.Tip()->GetMedianTimePast())); |
|
|
|
obj.push_back(Pair("mediantime", (int64_t)chainActive.Tip()->GetMedianTimePast())); |
|
|
|
obj.push_back(Pair("verificationprogress", GuessVerificationProgress(Params().TxData(), chainActive.Tip()))); |
|
|
|
obj.push_back(Pair("verificationprogress", GuessVerificationProgress(Params().TxData(), chainActive.Tip()))); |
|
|
|
obj.push_back(Pair("chainwork", chainActive.Tip()->nChainWork.GetHex())); |
|
|
|
obj.push_back(Pair("chainwork", chainActive.Tip()->nChainWork.GetHex())); |
|
|
|
|
|
|
|
obj.push_back(Pair("size_on_disk", CalculateCurrentUsage())); |
|
|
|
obj.push_back(Pair("pruned", fPruneMode)); |
|
|
|
obj.push_back(Pair("pruned", fPruneMode)); |
|
|
|
|
|
|
|
if (fPruneMode) { |
|
|
|
|
|
|
|
CBlockIndex* block = chainActive.Tip(); |
|
|
|
|
|
|
|
assert(block); |
|
|
|
|
|
|
|
while (block->pprev && (block->pprev->nStatus & BLOCK_HAVE_DATA)) { |
|
|
|
|
|
|
|
block = block->pprev; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
obj.push_back(Pair("pruneheight", block->nHeight)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// if 0, execution bypasses the whole if block.
|
|
|
|
|
|
|
|
bool automatic_pruning = (gArgs.GetArg("-prune", 0) != 1); |
|
|
|
|
|
|
|
obj.push_back(Pair("automatic_pruning", automatic_pruning)); |
|
|
|
|
|
|
|
if (automatic_pruning) { |
|
|
|
|
|
|
|
obj.push_back(Pair("prune_target_size", nPruneTarget)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const Consensus::Params& consensusParams = Params().GetConsensus(); |
|
|
|
const Consensus::Params& consensusParams = Params().GetConsensus(); |
|
|
|
CBlockIndex* tip = chainActive.Tip(); |
|
|
|
CBlockIndex* tip = chainActive.Tip(); |
|
|
@ -1195,14 +1215,6 @@ UniValue getblockchaininfo(const JSONRPCRequest& request) |
|
|
|
obj.push_back(Pair("softforks", softforks)); |
|
|
|
obj.push_back(Pair("softforks", softforks)); |
|
|
|
obj.push_back(Pair("bip9_softforks", bip9_softforks)); |
|
|
|
obj.push_back(Pair("bip9_softforks", bip9_softforks)); |
|
|
|
|
|
|
|
|
|
|
|
if (fPruneMode) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
CBlockIndex *block = chainActive.Tip(); |
|
|
|
|
|
|
|
while (block && block->pprev && (block->pprev->nStatus & BLOCK_HAVE_DATA)) |
|
|
|
|
|
|
|
block = block->pprev; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
obj.push_back(Pair("pruneheight", block->nHeight)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
obj.push_back(Pair("warnings", GetWarnings("statusbar"))); |
|
|
|
obj.push_back(Pair("warnings", GetWarnings("statusbar"))); |
|
|
|
return obj; |
|
|
|
return obj; |
|
|
|
} |
|
|
|
} |
|
|
|