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

@ -848,16 +848,20 @@ UniValue getchaintips(const UniValue& params, bool fHelp)
"\nResult:\n" "\nResult:\n"
"[\n" "[\n"
" {\n" " {\n"
" \"height\": xxxx, (numeric) height of the chain tip\n" " \"height\": xxxx, (numeric) height of the chain tip\n"
" \"hash\": \"xxxx\", (string) block hash of the tip\n" " \"hash\": \"xxxx\", (string) block hash of the tip\n"
" \"branchlen\": 0 (numeric) zero for main chain\n" " \"difficulty\" : x.xxx, (numeric) The difficulty\n"
" \"status\": \"active\" (string) \"active\" for the main chain\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"
" {\n" " {\n"
" \"height\": xxxx,\n" " \"height\": xxxx,\n"
" \"hash\": \"xxxx\",\n" " \"hash\": \"xxxx\",\n"
" \"branchlen\": 1 (numeric) length of branch connecting the tip to the main chain\n" " \"difficulty\" : x.xxx,\n"
" \"status\": \"xxxx\" (string) status of the chain (active, valid-fork, valid-headers, headers-only, invalid)\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" " }\n"
"]\n" "]\n"
"Possible values for status:\n" "Possible values for status:\n"
@ -911,6 +915,7 @@ UniValue getchaintips(const UniValue& params, bool fHelp)
obj.push_back(Pair("height", block->nHeight)); obj.push_back(Pair("height", block->nHeight));
obj.push_back(Pair("hash", block->phashBlock->GetHex())); obj.push_back(Pair("hash", block->phashBlock->GetHex()));
obj.push_back(Pair("difficulty", GetDifficulty(block))); obj.push_back(Pair("difficulty", GetDifficulty(block)));
obj.push_back(Pair("chainwork", block->nChainWork.GetHex()));
obj.push_back(Pair("branchlen", branchLen)); obj.push_back(Pair("branchlen", branchLen));
string status; string status;