Skip to content

Commit

Permalink
Add block "confirmations" to getblock, mainly for identifying orphans
Browse files Browse the repository at this point in the history
  • Loading branch information
luke-jr committed May 8, 2012
1 parent a2ea797 commit d4e0930
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/bitcoinrpc.cpp
Expand Up @@ -172,6 +172,9 @@ Object blockToJSON(const CBlock& block, const CBlockIndex* blockindex)
{
Object result;
result.push_back(Pair("hash", block.GetHash().GetHex()));
CMerkleTx txGen(block.vtx[0]);
txGen.SetMerkleBranch(&block);
result.push_back(Pair("confirmations", (int)txGen.GetDepthInMainChain()));
result.push_back(Pair("size", (int)::GetSerializeSize(block, SER_NETWORK, PROTOCOL_VERSION)));
result.push_back(Pair("height", blockindex->nHeight));
result.push_back(Pair("version", block.nVersion));
Expand Down

0 comments on commit d4e0930

Please sign in to comment.