Fix getbalance
authoralex <alex@alex-VirtualBox.(none)>
Mon, 29 Jul 2013 22:20:31 +0000 (02:20 +0400)
committeralex <alex@alex-VirtualBox.(none)>
Mon, 29 Jul 2013 22:20:31 +0000 (02:20 +0400)
src/rpcwallet.cpp
src/wallet.cpp

index acd7944..3a1c2b9 100644 (file)
@@ -553,12 +553,12 @@ Value getbalance(const Array& params, bool fHelp)
     if (params[0].get_str() == "*") {
         // Calculate total balance a different way from GetBalance()
         // (GetBalance() sums up all unspent TxOuts)
-        // getbalance and getbalance '*' should always return the same number.
+        // getbalance and getbalance '*' 0 should return the same number.
         int64 nBalance = 0;
         for (map<uint256, CWalletTx>::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it)
         {
             const CWalletTx& wtx = (*it).second;
-            if (!wtx.IsFinal())
+            if (!wtx.IsConfirmed())
                 continue;
 
             int64 allGeneratedImmature, allGeneratedMature, allFee;
index 64e3318..9988577 100644 (file)
@@ -975,7 +975,7 @@ int64 CWallet::GetBalance() const
         for (map<uint256, CWalletTx>::const_iterator it = mapWallet.begin(); it != mapWallet.end(); ++it)
         {
             const CWalletTx* pcoin = &(*it).second;
-            if (pcoin->IsFinal() && pcoin->IsConfirmed())
+            if (pcoin->IsConfirmed())
                 nTotal += pcoin->GetAvailableCredit();
         }
     }