From cce16fdc6871defc02e1459ca89d08c492103417 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Fri, 27 May 2011 00:05:16 -0400 Subject: [PATCH] Add blockhash and blockindex to transaction info --- src/rpc.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/rpc.cpp b/src/rpc.cpp index 885ffd1f..accaf19a 100644 --- a/src/rpc.cpp +++ b/src/rpc.cpp @@ -90,7 +90,13 @@ Value ValueFromAmount(int64 amount) void WalletTxToJSON(const CWalletTx& wtx, Object& entry) { - entry.push_back(Pair("confirmations", wtx.GetDepthInMainChain())); + int confirms = wtx.GetDepthInMainChain(); + entry.push_back(Pair("confirmations", confirms)); + if (confirms) + { + entry.push_back(Pair("blockhash", wtx.hashBlock.GetHex())); + entry.push_back(Pair("blockindex", wtx.nIndex)); + } entry.push_back(Pair("txid", wtx.GetHash().GetHex())); entry.push_back(Pair("time", (boost::int64_t)wtx.GetTxTime())); BOOST_FOREACH(const PAIRTYPE(string,string)& item, wtx.mapValue)