aboutsummaryrefslogtreecommitdiff
path: root/src/wallet.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/wallet.cpp')
-rw-r--r--src/wallet.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/wallet.cpp b/src/wallet.cpp
index 8bbb80cf25..30a561dcb4 100644
--- a/src/wallet.cpp
+++ b/src/wallet.cpp
@@ -5,7 +5,6 @@
#include "headers.h"
#include "db.h"
-#include "cryptopp/sha.h"
#include "crypter.h"
using namespace std;
@@ -260,7 +259,7 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn)
if (fInsertedNew || fUpdated)
if (!wtx.WriteToDisk())
return false;
-
+#ifndef QT_GUI
// If default receiving address gets used, replace it with a new one
CScript scriptDefaultKey;
scriptDefaultKey.SetBitcoinAddress(vchDefaultKey);
@@ -276,7 +275,7 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn)
}
}
}
-
+#endif
// Notify UI
vWalletUpdated.push_back(hash);
@@ -728,6 +727,21 @@ int64 CWallet::GetBalance() const
return nTotal;
}
+int64 CWallet::GetUnconfirmedBalance() const
+{
+ int64 nTotal = 0;
+ CRITICAL_BLOCK(cs_wallet)
+ {
+ 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
{