Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.cpp
Show First 20 Lines • Show All 2,184 Lines • ▼ Show 20 Lines | for (const auto &entry : mapWallet) { | ||||
const CWalletTx *pcoin = &entry.second; | const CWalletTx *pcoin = &entry.second; | ||||
if (pcoin->IsTrusted()) { | if (pcoin->IsTrusted()) { | ||||
nTotal += pcoin->GetAvailableCredit(); | nTotal += pcoin->GetAvailableCredit(); | ||||
} | } | ||||
} | } | ||||
return nTotal; | return nTotal; | ||||
} | } | ||||
bool CWallet::CheckBalance(Amount toSpend) const { | |||||
LOCK2(cs_main, cs_wallet); | |||||
Amount nTotal = Amount::zero(); | |||||
for (const auto &entry : mapWallet) { | |||||
const CWalletTx *pcoin = &entry.second; | |||||
if (pcoin->IsTrusted()) { | |||||
nTotal += pcoin->GetAvailableCredit(); | |||||
if (nTotal >= toSpend) { | |||||
return true; | |||||
} | |||||
} | |||||
} | |||||
return false; | |||||
} | |||||
Amount CWallet::GetUnconfirmedBalance() const { | Amount CWallet::GetUnconfirmedBalance() const { | ||||
LOCK2(cs_main, cs_wallet); | LOCK2(cs_main, cs_wallet); | ||||
Amount nTotal = Amount::zero(); | Amount nTotal = Amount::zero(); | ||||
for (const auto &entry : mapWallet) { | for (const auto &entry : mapWallet) { | ||||
const CWalletTx *pcoin = &entry.second; | const CWalletTx *pcoin = &entry.second; | ||||
if (!pcoin->IsTrusted() && pcoin->GetDepthInMainChain() == 0 && | if (!pcoin->IsTrusted() && pcoin->GetDepthInMainChain() == 0 && | ||||
▲ Show 20 Lines • Show All 2,311 Lines • Show Last 20 Lines |