aboutsummaryrefslogtreecommitdiff
path: root/src/bitcoinrpc.cpp
diff options
context:
space:
mode:
authorLuke Dashjr <luke-jr+git@utopios.org>2012-02-22 13:26:25 -0500
committerLuke Dashjr <luke-jr+git@utopios.org>2012-05-08 21:04:47 +0000
commitd4e09300f3f9deb401e38fdf50fd0ff8d3f15b50 (patch)
treea97baa6ad03cc5e12cd3d7aa51c004633e2e11d7 /src/bitcoinrpc.cpp
parenta2ea7975936cab4c56dd737de37004ae3298104d (diff)
Add block "confirmations" to getblock, mainly for identifying orphans
Diffstat (limited to 'src/bitcoinrpc.cpp')
-rw-r--r--src/bitcoinrpc.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp
index 54bec8623d..7d2450c160 100644
--- a/src/bitcoinrpc.cpp
+++ b/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));