Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.cpp
Show First 20 Lines • Show All 2,339 Lines • ▼ Show 20 Lines | Amount CWallet::GetLegacyBalance(const isminefilter &filter, int minDepth, | ||||
const std::string *account) const { | const std::string *account) const { | ||||
LOCK2(cs_main, cs_wallet); | LOCK2(cs_main, cs_wallet); | ||||
Amount balance = Amount::zero(); | Amount balance = Amount::zero(); | ||||
for (const auto &entry : mapWallet) { | for (const auto &entry : mapWallet) { | ||||
const CWalletTx &wtx = entry.second; | const CWalletTx &wtx = entry.second; | ||||
const int depth = wtx.GetDepthInMainChain(); | const int depth = wtx.GetDepthInMainChain(); | ||||
if (depth < 0 || !CheckFinalTx(*wtx.tx) || wtx.IsImmatureCoinBase()) { | if (depth < 0 || !CheckFinalTx(*wtx.tx) || wtx.IsImmatureCoinBase()) { | ||||
continue; | continue; | ||||
} | } | ||||
// Loop through tx outputs and add incoming payments. For outgoing txs, | // Loop through tx outputs and add incoming payments. For outgoing txs, | ||||
// treat change outputs specially, as part of the amount debited. | // treat change outputs specially, as part of the amount debited. | ||||
Amount debit = wtx.GetDebit(filter); | Amount debit = wtx.GetDebit(filter); | ||||
const bool outgoing = debit > Amount::zero(); | const bool outgoing = debit > Amount::zero(); | ||||
for (const CTxOut &out : wtx.tx->vout) { | for (const CTxOut &out : wtx.tx->vout) { | ||||
▲ Show 20 Lines • Show All 2,541 Lines • Show Last 20 Lines |