[rpc] Add initialblockdownload to getblockchaininfo

pull/476/merge
John Newbery 7 years ago
parent 57ee73990f
commit bd9c18171d

@ -1135,6 +1135,7 @@ UniValue getblockchaininfo(const JSONRPCRequest& request)
" \"difficulty\": xxxxxx, (numeric) the current difficulty\n" " \"difficulty\": xxxxxx, (numeric) the current difficulty\n"
" \"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"
" \"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" " \"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" " \"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"
@ -1183,6 +1184,7 @@ UniValue getblockchaininfo(const JSONRPCRequest& request)
obj.push_back(Pair("difficulty", (double)GetDifficulty())); obj.push_back(Pair("difficulty", (double)GetDifficulty()));
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("initialblockdownload", IsInitialBlockDownload()));
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("size_on_disk", CalculateCurrentUsage()));
obj.push_back(Pair("pruned", fPruneMode)); obj.push_back(Pair("pruned", fPruneMode));

@ -5,6 +5,7 @@
"""Test RPCs related to blockchainstate. """Test RPCs related to blockchainstate.
Test the following RPCs: Test the following RPCs:
- getblockchaininfo
- gettxoutsetinfo - gettxoutsetinfo
- getdifficulty - getdifficulty
- getbestblockhash - getbestblockhash
@ -58,6 +59,7 @@ class BlockchainTest(BitcoinTestFramework):
'chainwork', 'chainwork',
'difficulty', 'difficulty',
'headers', 'headers',
'initialblockdownload',
'mediantime', 'mediantime',
'pruned', 'pruned',
'size_on_disk', 'size_on_disk',

Loading…
Cancel
Save