aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Dashjr <luke-jr+git@utopios.org>2011-05-27 00:05:16 -0400
committerLuke Dashjr <luke-jr+git@utopios.org>2011-12-16 19:05:41 -0500
commitcce16fdc6871defc02e1459ca89d08c492103417 (patch)
treecda468ed72847820a3588bf37aeb8518bccd5ac7
parentc7eb151ad0ed441d6fd598551059a9bbfb09e99e (diff)
downloadbitcoin-cce16fdc6871defc02e1459ca89d08c492103417.tar.xz
Add blockhash and blockindex to transaction info
-rw-r--r--src/rpc.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/rpc.cpp b/src/rpc.cpp
index 885ffd1f2b..accaf19aeb 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)