display chainwork for every tip in getchaintips (#1237)

This commit is contained in:
UdjinM6 2016-12-30 20:38:53 +04:00 committed by GitHub
parent 96dda2790c
commit 7544a70e1b

View File

@ -850,12 +850,16 @@ UniValue getchaintips(const UniValue& params, bool fHelp)
" {\n"
" \"height\": xxxx, (numeric) height of the chain tip\n"
" \"hash\": \"xxxx\", (string) block hash of the tip\n"
" \"difficulty\" : x.xxx, (numeric) The difficulty\n"
" \"chainwork\" : \"0000...1f3\" (string) Expected number of hashes required to produce the current chain (in hex)\n"
" \"branchlen\": 0 (numeric) zero for main chain\n"
" \"status\": \"active\" (string) \"active\" for the main chain\n"
" },\n"
" {\n"
" \"height\": xxxx,\n"
" \"hash\": \"xxxx\",\n"
" \"difficulty\" : x.xxx,\n"
" \"chainwork\" : \"0000...1f3\"\n"
" \"branchlen\": 1 (numeric) length of branch connecting the tip to the main chain\n"
" \"status\": \"xxxx\" (string) status of the chain (active, valid-fork, valid-headers, headers-only, invalid)\n"
" }\n"
@ -911,6 +915,7 @@ UniValue getchaintips(const UniValue& params, bool fHelp)
obj.push_back(Pair("height", block->nHeight));
obj.push_back(Pair("hash", block->phashBlock->GetHex()));
obj.push_back(Pair("difficulty", GetDifficulty(block)));
obj.push_back(Pair("chainwork", block->nChainWork.GetHex()));
obj.push_back(Pair("branchlen", branchLen));
string status;