add amountZat field to listunspent

This commit is contained in:
Alfredo Garcia 2020-01-28 20:44:36 -03:00
parent 9a55c8b238
commit 76e7f21d4a
2 changed files with 3 additions and 0 deletions

View File

@ -220,6 +220,7 @@ class WalletTest (BitcoinTestFramework):
if uTx['txid'] == zeroValueTxid:
found = True
assert_equal(uTx['amount'], Decimal('0.00000000'))
assert_equal(uTx['amountZat'], int('0'))
assert(found)
#do some -walletbroadcast tests

View File

@ -2411,6 +2411,7 @@ UniValue listunspent(const UniValue& params, bool fHelp)
" \"account\" : \"account\", (string) DEPRECATED. The associated account, or \"\" for the default account\n"
" \"scriptPubKey\" : \"key\", (string) the script key\n"
" \"amount\" : x.xxx, (numeric) the transaction amount in " + CURRENCY_UNIT + "\n"
" \"amountZat\" : xxxx (numeric) the transaction amount in zatoshis\n"
" \"confirmations\" : n, (numeric) The number of confirmations\n"
" \"redeemScript\" : n (string) The redeemScript if scriptPubKey is P2SH\n"
" \"spendable\" : xxx (bool) Whether we have the private keys to spend this output\n"
@ -2486,6 +2487,7 @@ UniValue listunspent(const UniValue& params, bool fHelp)
entry.pushKV("scriptPubKey", HexStr(scriptPubKey.begin(), scriptPubKey.end()));
entry.pushKV("amount", ValueFromAmount(out.tx->vout[out.i].nValue));
entry.pushKV("amountZat", out.tx->vout[out.i].nValue);
entry.pushKV("confirmations", out.nDepth);
entry.pushKV("spendable", out.fSpendable);
results.push_back(entry);