Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/rpcwallet.cpp
Show First 20 Lines • Show All 2,360 Lines • ▼ Show 20 Lines | static UniValue gettransaction(const Config &config, | ||||
} | } | ||||
UniValue entry(UniValue::VOBJ); | UniValue entry(UniValue::VOBJ); | ||||
if (!pwallet->mapWallet.count(txid)) { | if (!pwallet->mapWallet.count(txid)) { | ||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, | throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, | ||||
"Invalid or non-wallet transaction id"); | "Invalid or non-wallet transaction id"); | ||||
} | } | ||||
const CWalletTx &wtx = pwallet->mapWallet[txid]; | const CWalletTx &wtx = pwallet->mapWallet.at(txid); | ||||
Amount nCredit = wtx.GetCredit(filter); | Amount nCredit = wtx.GetCredit(filter); | ||||
Amount nDebit = wtx.GetDebit(filter); | Amount nDebit = wtx.GetDebit(filter); | ||||
Amount nNet = nCredit - nDebit; | Amount nNet = nCredit - nDebit; | ||||
Amount nFee = (wtx.IsFromMe(filter) ? wtx.tx->GetValueOut() - nDebit | Amount nFee = (wtx.IsFromMe(filter) ? wtx.tx->GetValueOut() - nDebit | ||||
: Amount::zero()); | : Amount::zero()); | ||||
entry.pushKV("amount", ValueFromAmount(nNet - nFee)); | entry.pushKV("amount", ValueFromAmount(nNet - nFee)); | ||||
▲ Show 20 Lines • Show All 1,430 Lines • Show Last 20 Lines |