Merge pull request #5996 from adityapk00/gettx_version

Add tx version
This commit is contained in:
Kris Nuttycombe 2022-07-14 07:13:07 -06:00 committed by GitHub
commit 51cc19d492
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -1719,6 +1719,7 @@ UniValue gettransaction(const UniValue& params, bool fHelp)
"\nResult:\n"
"{\n"
" \"status\" : \"mined|waiting|expiringsoon|expired\", (string) The transaction status, can be 'mined', 'waiting', 'expiringsoon' or 'expired'\n"
" \"version\" : \"x\", (string) The transaction version\n"
" \"amount\" : x.xxx, (numeric) The transaction amount in " + CURRENCY_UNIT + "\n"
" \"amountZat\" : x (numeric) The amount in " + MINOR_CURRENCY_UNIT + "\n"
" \"confirmations\" : n, (numeric) The number of confirmations\n"
@ -1778,6 +1779,7 @@ UniValue gettransaction(const UniValue& params, bool fHelp)
CAmount nNet = nCredit - nDebit;
CAmount nFee = (wtx.IsFromMe(filter) ? wtx.GetValueOut() - nDebit : 0);
entry.pushKV("version", wtx.nVersion);
entry.pushKV("amount", ValueFromAmount(nNet - nFee));
entry.pushKV("amountZat", nNet - nFee);
if (wtx.IsFromMe(filter))