From 7544a70e1b53a4ee1fd22e736988b08343729636 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Fri, 30 Dec 2016 20:38:53 +0400 Subject: [PATCH] display chainwork for every tip in getchaintips (#1237) --- src/rpcblockchain.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index dc3141f7f..e24f4f61f 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -848,16 +848,20 @@ UniValue getchaintips(const UniValue& params, bool fHelp) "\nResult:\n" "[\n" " {\n" - " \"height\": xxxx, (numeric) height of the chain tip\n" - " \"hash\": \"xxxx\", (string) block hash of the tip\n" - " \"branchlen\": 0 (numeric) zero for main chain\n" - " \"status\": \"active\" (string) \"active\" for the main chain\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" - " \"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" + " \"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" "]\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("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;