Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.cpp
Show First 20 Lines • Show All 2,038 Lines • ▼ Show 20 Lines | Amount CWalletTx::GetAvailableCredit(bool fUseCache) const { | ||||
} | } | ||||
Amount nCredit = Amount::zero(); | Amount nCredit = Amount::zero(); | ||||
for (uint32_t i = 0; i < tx->vout.size(); i++) { | for (uint32_t i = 0; i < tx->vout.size(); i++) { | ||||
if (!pwallet->IsSpent(GetId(), i)) { | if (!pwallet->IsSpent(GetId(), i)) { | ||||
const CTxOut &txout = tx->vout[i]; | const CTxOut &txout = tx->vout[i]; | ||||
nCredit += pwallet->GetCredit(txout, ISMINE_SPENDABLE); | nCredit += pwallet->GetCredit(txout, ISMINE_SPENDABLE); | ||||
if (!MoneyRange(nCredit)) { | if (!MoneyRange(nCredit)) { | ||||
throw std::runtime_error( | throw std::runtime_error(std::string(__func__) + | ||||
"CWalletTx::GetAvailableCredit() : value out of range"); | " : value out of range"); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
nAvailableCreditCached = nCredit; | nAvailableCreditCached = nCredit; | ||||
fAvailableCreditCached = true; | fAvailableCreditCached = true; | ||||
return nCredit; | return nCredit; | ||||
} | } | ||||
Show All 28 Lines | Amount CWalletTx::GetAvailableWatchOnlyCredit(const bool fUseCache) const { | ||||
} | } | ||||
Amount nCredit = Amount::zero(); | Amount nCredit = Amount::zero(); | ||||
for (uint32_t i = 0; i < tx->vout.size(); i++) { | for (uint32_t i = 0; i < tx->vout.size(); i++) { | ||||
if (!pwallet->IsSpent(GetId(), i)) { | if (!pwallet->IsSpent(GetId(), i)) { | ||||
const CTxOut &txout = tx->vout[i]; | const CTxOut &txout = tx->vout[i]; | ||||
nCredit += pwallet->GetCredit(txout, ISMINE_WATCH_ONLY); | nCredit += pwallet->GetCredit(txout, ISMINE_WATCH_ONLY); | ||||
if (!MoneyRange(nCredit)) { | if (!MoneyRange(nCredit)) { | ||||
throw std::runtime_error( | throw std::runtime_error(std::string(__func__) + | ||||
"CWalletTx::GetAvailableCredit() : value out of range"); | ": value out of range"); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
nAvailableWatchCreditCached = nCredit; | nAvailableWatchCreditCached = nCredit; | ||||
fAvailableWatchCreditCached = true; | fAvailableWatchCreditCached = true; | ||||
return nCredit; | return nCredit; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 2,540 Lines • Show Last 20 Lines |