Browse Source

Add call to request unconfirmed balance

pull/1/head
Wladimir J. van der Laan 11 years ago
parent
commit
a35ee96336
  1. 15
      src/wallet.cpp
  2. 1
      src/wallet.h

15
src/wallet.cpp

@ -570,6 +570,21 @@ int64 CWallet::GetBalance() const @@ -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
{

1
src/wallet.h

@ -57,6 +57,7 @@ public: @@ -57,6 +57,7 @@ public:
void ReacceptWalletTransactions();
void ResendWalletTransactions();
int64 GetBalance() const;
int64 GetUnconfirmedBalance() const;
bool CreateTransaction(const std::vector<std::pair<CScript, int64> >& vecSend, CWalletTx& wtxNew, CReserveKey& reservekey, int64& nFeeRet);
bool CreateTransaction(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, CReserveKey& reservekey, int64& nFeeRet);
bool CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey);

Loading…
Cancel
Save