mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-23 23:27:21 +01:00
Merge pull request #2149 from sipa/fixtxoutrpc
Make output of gettxout RPC more consistent
This commit is contained in:
commit
2c7847349d
1 changed files with 4 additions and 3 deletions
|
@ -9,6 +9,8 @@
|
||||||
using namespace json_spirit;
|
using namespace json_spirit;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
void ScriptPubKeyToJSON(const CScript& scriptPubKey, Object& out);
|
||||||
|
|
||||||
double GetDifficulty(const CBlockIndex* blockindex)
|
double GetDifficulty(const CBlockIndex* blockindex)
|
||||||
{
|
{
|
||||||
// Floating point number that is a multiple of the minimum difficulty,
|
// 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));
|
ret.push_back(Pair("confirmations", 0));
|
||||||
else
|
else
|
||||||
ret.push_back(Pair("confirmations", pcoinsTip->GetBestBlock()->nHeight - coins.nHeight + 1));
|
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;
|
Object o;
|
||||||
o.push_back(Pair("asm", coins.vout[n].scriptPubKey.ToString()));
|
ScriptPubKeyToJSON(coins.vout[n].scriptPubKey, o);
|
||||||
o.push_back(Pair("hex", HexStr(coins.vout[n].scriptPubKey.begin(), coins.vout[n].scriptPubKey.end())));
|
|
||||||
ret.push_back(Pair("scriptPubKey", o));
|
ret.push_back(Pair("scriptPubKey", o));
|
||||||
ret.push_back(Pair("version", coins.nVersion));
|
ret.push_back(Pair("version", coins.nVersion));
|
||||||
ret.push_back(Pair("coinbase", coins.fCoinBase));
|
ret.push_back(Pair("coinbase", coins.fCoinBase));
|
||||||
|
|
Loading…
Add table
Reference in a new issue