aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Todd <pete@petertodd.org>2013-07-24 01:58:23 -0400
committerPeter Todd <pete@petertodd.org>2013-07-24 01:58:23 -0400
commit1b3656d50bda646822fd954714a88dea1528548b (patch)
tree20937996804d8115579a9a95a54589a6b657180e
parent0a740650a52a21b7d82b43524017c87643af3224 (diff)
Add 'chainwork' to getblock
Returns nChainWork from the block index, the total work done by all blocks since the genesis block.
-rw-r--r--src/rpcblockchain.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp
index edaa732225..ba346f19d9 100644
--- a/src/rpcblockchain.cpp
+++ b/src/rpcblockchain.cpp
@@ -62,6 +62,7 @@ Object blockToJSON(const CBlock& block, const CBlockIndex* blockindex)
result.push_back(Pair("nonce", (boost::uint64_t)block.nNonce));
result.push_back(Pair("bits", HexBits(block.nBits)));
result.push_back(Pair("difficulty", GetDifficulty(blockindex)));
+ result.push_back(Pair("chainwork", blockindex->nChainWork.GetHex()));
if (blockindex->pprev)
result.push_back(Pair("previousblockhash", blockindex->pprev->GetBlockHash().GetHex()));