aboutsummaryrefslogtreecommitdiff
path: root/src/wallet.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <[email protected]>2011-07-15 15:09:49 +0200
committerWladimir J. van der Laan <[email protected]>2011-07-15 15:09:49 +0200
commita35ee9633690fbadc001b2d8fe1dd3ebb852dc25 (patch)
treea2b22bdcd1d3aeef4181fdae3771fac004fc2bda /src/wallet.cpp
parentremove magic number: change threshold for nLockTime to constant (diff)
downloaddiscoin-a35ee9633690fbadc001b2d8fe1dd3ebb852dc25.tar.xz
discoin-a35ee9633690fbadc001b2d8fe1dd3ebb852dc25.zip
Add call to request unconfirmed balance
Diffstat (limited to 'src/wallet.cpp')
-rw-r--r--src/wallet.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/wallet.cpp b/src/wallet.cpp
index 5b88f387c..fa5775524 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
{