Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add block "confirmations" to getblock, mainly for identifying orphans

  • Loading branch information...
commit d4e09300f3f9deb401e38fdf50fd0ff8d3f15b50 1 parent a2ea797
@luke-jr authored
Showing with 3 additions and 0 deletions.
  1. +3 −0  src/bitcoinrpc.cpp
3  src/bitcoinrpc.cpp
@@ -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));
Please sign in to comment.
Something went wrong with that request. Please try again.