changeset 29635:c9a2af7a47b1

rpc: include height in getrawtransaction results
author Braydon Fuller <courier@braydon.com>
date Tue, 22 Mar 2016 13:55:19 -0400
parents 388e58e8be25
children f2f57b7f2171
files src/rpcrawtransaction.cpp
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/rpcrawtransaction.cpp	Thu Mar 17 16:40:16 2016 -0400
+++ b/src/rpcrawtransaction.cpp	Tue Mar 22 13:55:19 2016 -0400
@@ -101,12 +101,14 @@
         if (mi != mapBlockIndex.end() && (*mi).second) {
             CBlockIndex* pindex = (*mi).second;
             if (chainActive.Contains(pindex)) {
+                entry.push_back(Pair("height", pindex->nHeight));
                 entry.push_back(Pair("confirmations", 1 + chainActive.Height() - pindex->nHeight));
                 entry.push_back(Pair("time", pindex->GetBlockTime()));
                 entry.push_back(Pair("blocktime", pindex->GetBlockTime()));
+            } else {
+                entry.push_back(Pair("height", -1));
+                entry.push_back(Pair("confirmations", 0));
             }
-            else
-                entry.push_back(Pair("confirmations", 0));
         }
     }
 }