Browse Source

Add 'chainwork' to getblock

Returns nChainWork from the block index, the total work done by all
blocks since the genesis block.
0.10
Peter Todd 12 years ago
parent
commit
1b3656d50b
  1. 1
      src/rpcblockchain.cpp

1
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("nonce", (boost::uint64_t)block.nNonce));
result.push_back(Pair("bits", HexBits(block.nBits))); result.push_back(Pair("bits", HexBits(block.nBits)));
result.push_back(Pair("difficulty", GetDifficulty(blockindex))); result.push_back(Pair("difficulty", GetDifficulty(blockindex)));
result.push_back(Pair("chainwork", blockindex->nChainWork.GetHex()));
if (blockindex->pprev) if (blockindex->pprev)
result.push_back(Pair("previousblockhash", blockindex->pprev->GetBlockHash().GetHex())); result.push_back(Pair("previousblockhash", blockindex->pprev->GetBlockHash().GetHex()));

Loading…
Cancel
Save