aboutsummaryrefslogtreecommitdiff
path: root/src/rpcblockchain.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2013-01-04 22:51:00 +0100
committerPieter Wuille <pieter.wuille@gmail.com>2013-01-04 22:51:11 +0100
commit4e68391a7f3b3361584af032bf671bd9dc0677fe (patch)
treeec3feb0d3119c4dc32bef6f764f5663f505a7747 /src/rpcblockchain.cpp
parentea9788517bfa3e53e192c5af9e64e73625f9db74 (diff)
Make output of gettxout RPC more consistent
* Report "value" in BTC, rather than "amount" in satoshis * Use ScriptPubKeyToJSON to report script data
Diffstat (limited to 'src/rpcblockchain.cpp')
-rw-r--r--src/rpcblockchain.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp
index 5554f039a7..2200679050 100644
--- a/src/rpcblockchain.cpp
+++ b/src/rpcblockchain.cpp
@@ -9,6 +9,8 @@
using namespace json_spirit;
using namespace std;
+void ScriptPubKeyToJSON(const CScript& scriptPubKey, Object& out);
+
double GetDifficulty(const CBlockIndex* blockindex)
{
// Floating point number that is a multiple of the minimum difficulty,
@@ -213,10 +215,9 @@ Value gettxout(const Array& params, bool fHelp)
ret.push_back(Pair("confirmations", 0));
else
ret.push_back(Pair("confirmations", pcoinsTip->GetBestBlock()->nHeight - coins.nHeight + 1));
- ret.push_back(Pair("amount", (boost::int64_t)coins.vout[n].nValue));
+ ret.push_back(Pair("value", ValueFromAmount(coins.vout[n].nValue)));
Object o;
- o.push_back(Pair("asm", coins.vout[n].scriptPubKey.ToString()));
- o.push_back(Pair("hex", HexStr(coins.vout[n].scriptPubKey.begin(), coins.vout[n].scriptPubKey.end())));
+ ScriptPubKeyToJSON(coins.vout[n].scriptPubKey, o);
ret.push_back(Pair("scriptPubKey", o));
ret.push_back(Pair("version", coins.nVersion));
ret.push_back(Pair("coinbase", coins.fCoinBase));