diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2011-07-11 20:42:10 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2011-07-11 20:42:10 +0200 |
commit | df5ccbd2b2c72039f1e0e69fc51957f7c2d6068d (patch) | |
tree | 9aaf5b94f95172365a44be8b78eae7b2ba382a27 /src/wallet.cpp | |
parent | eee0d2391cb9d2c72d75c9912363392f87c7b976 (diff) |
Show unconfirmed balance on overview page
Diffstat (limited to 'src/wallet.cpp')
-rw-r--r-- | src/wallet.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/wallet.cpp b/src/wallet.cpp index 5b88f387c7..fa57755242 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -570,6 +570,21 @@ int64 CWallet::GetBalance() const return nTotal; } +int64 CWallet::GetUnconfirmedBalance() const +{ + int64 nTotal = 0; + CRITICAL_BLOCK(cs_mapWallet) + { + for (map<uint256, CWalletTx>::const_iterator it = mapWallet.begin(); it != mapWallet.end(); ++it) + { + const CWalletTx* pcoin = &(*it).second; + if (pcoin->IsFinal() && pcoin->IsConfirmed()) + continue; + nTotal += pcoin->GetAvailableCredit(); + } + } + return nTotal; +} bool CWallet::SelectCoinsMinConf(int64 nTargetValue, int nConfMine, int nConfTheirs, set<pair<const CWalletTx*,unsigned int> >& setCoinsRet, int64& nValueRet) const { |