changeset 29656:604556232498

rpc: include height in spentinfo
author Braydon Fuller <courier@braydon.com>
date Tue, 12 Apr 2016 15:31:19 -0400
parents 81c811cfcccf
children 190090231c39
files qa/rpc-tests/spentindex.py src/rpcmisc.cpp src/rpcrawtransaction.cpp
diffstat 3 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/qa/rpc-tests/spentindex.py	Tue Apr 12 12:31:21 2016 -0400
+++ b/qa/rpc-tests/spentindex.py	Tue Apr 12 15:31:19 2016 -0400
@@ -66,11 +66,13 @@
         info = self.nodes[1].getspentinfo({"txid": unspent[0]["txid"], "index": unspent[0]["vout"]})
         assert_equal(info["txid"], txid)
         assert_equal(info["index"], 0)
+        assert_equal(info["height"], 106)
 
         # Check that verbose raw transaction includes spent info
         txVerbose = self.nodes[3].getrawtransaction(unspent[0]["txid"], 1)
         assert_equal(txVerbose["vout"][unspent[0]["vout"]]["spentTxId"], txid)
         assert_equal(txVerbose["vout"][unspent[0]["vout"]]["spentIndex"], 0)
+        assert_equal(txVerbose["vout"][unspent[0]["vout"]]["spentHeight"], 106)
 
         print "Passed\n"
 
--- a/src/rpcmisc.cpp	Tue Apr 12 12:31:21 2016 -0400
+++ b/src/rpcmisc.cpp	Tue Apr 12 15:31:19 2016 -0400
@@ -737,6 +737,7 @@
     UniValue obj(UniValue::VOBJ);
     obj.push_back(Pair("txid", value.txid.GetHex()));
     obj.push_back(Pair("index", (int)value.inputIndex));
+    obj.push_back(Pair("height", value.blockHeight));
 
     return obj;
 }
--- a/src/rpcrawtransaction.cpp	Tue Apr 12 12:31:21 2016 -0400
+++ b/src/rpcrawtransaction.cpp	Tue Apr 12 15:31:19 2016 -0400
@@ -99,6 +99,7 @@
         if (GetSpentIndex(spentKey, spentInfo)) {
             out.push_back(Pair("spentTxId", spentInfo.txid.GetHex()));
             out.push_back(Pair("spentIndex", (int)spentInfo.inputIndex));
+            out.push_back(Pair("spentHeight", spentInfo.blockHeight));
         }
 
         vout.push_back(out);