Set of several minor fixes:
authoralex <alex@alex-VirtualBox.(none)>
Sat, 25 Jan 2014 22:58:17 +0000 (02:58 +0400)
committeralex <alex@alex-VirtualBox.(none)>
Sat, 25 Jan 2014 22:58:17 +0000 (02:58 +0400)
* Fix winsock.h warnings while building for Windows;
* Add MarkUnspent for confirmed wallet transactions.

src/crypter.cpp
src/netbase.cpp
src/qt/qtipcserver.cpp
src/rpcnet.cpp
src/version.h
src/wallet.cpp
src/wallet.h

index 3a7f997..1f0e9df 100644 (file)
@@ -6,11 +6,11 @@
 #include <openssl/evp.h>
 #include <vector>
 #include <string>
+
+#include "crypter.h"
 #ifdef WIN32
 #include <windows.h>
 #endif
-
-#include "crypter.h"
 #include "scrypt.h"
 
 bool CCrypter::SetKeyFromPassphrase(const SecureString& strKeyData, const std::vector<unsigned char>& chSalt, const unsigned int nRounds, const unsigned int nDerivationMethod)
index 95d6493..7f1d69a 100644 (file)
@@ -3,8 +3,8 @@
 // Distributed under the MIT/X11 software license, see the accompanying
 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
 
-#include "netbase.h"
 #include "util.h"
+#include "netbase.h"
 #include "sync.h"
 
 #ifndef WIN32
index bb49dac..06c1502 100644 (file)
@@ -3,7 +3,7 @@
 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
 
 #include <boost/version.hpp>
-#if defined(WIN32) && BOOST_VERSION == 104900
+#if defined(WIN32)
 #define BOOST_INTERPROCESS_HAS_WINDOWS_KERNEL_BOOTTIME
 #define BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME
 #endif
index 04ea310..bd622a4 100644 (file)
@@ -2,8 +2,8 @@
 // Distributed under the MIT/X11 software license, see the accompanying
 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
 
-#include "net.h"
 #include "bitcoinrpc.h"
+#include "net.h"
 #include "alert.h"
 #include "wallet.h"
 #include "db.h"
index e53f179..6a519db 100644 (file)
@@ -52,6 +52,6 @@ static const int MEMPOOL_GD_VERSION = 60002;
 #define DISPLAY_VERSION_MAJOR       0
 #define DISPLAY_VERSION_MINOR       4
 #define DISPLAY_VERSION_REVISION    4
-#define DISPLAY_VERSION_BUILD       6
+#define DISPLAY_VERSION_BUILD       7
 
 #endif
index 4fadcf7..97db80c 100644 (file)
@@ -353,7 +353,7 @@ CWallet::TxItems CWallet::OrderedTxItems(std::list<CAccountingEntry>& acentries,
     return txOrdered;
 }
 
-void CWallet::WalletUpdateSpent(const CTransaction &tx)
+void CWallet::WalletUpdateSpent(const CTransaction &tx, bool fBlock)
 {
     // Anytime a signature is successfully verified, it's proof the outpoint is spent.
     // Update the wallet spent flag if it doesn't know due to wallet.dat being
@@ -377,6 +377,23 @@ void CWallet::WalletUpdateSpent(const CTransaction &tx)
                 }
             }
         }
+
+        if (fBlock)
+        {
+            uint256 hash = tx.GetHash();
+            map<uint256, CWalletTx>::iterator mi = mapWallet.find(hash);
+            CWalletTx& wtx = (*mi).second;
+
+            BOOST_FOREACH(const CTxOut& txout, tx.vout)
+            {
+                if (IsMine(txout))
+                {
+                    wtx.MarkUnspent(&txout - &tx.vout[0]);
+                    wtx.WriteToDisk();
+                    NotifyTransactionChanged(this, hash, CT_UPDATED);
+                }
+            }
+        }
     }
 }
 
@@ -499,7 +516,7 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn)
         }
 #endif
         // since AddToWallet is called directly for self-originating transactions, check for consumption of own coins
-        WalletUpdateSpent(wtx);
+        WalletUpdateSpent(wtx, (wtxIn.hashBlock != 0));
 
         // Notify UI of new or updated transaction
         NotifyTransactionChanged(this, hash, fInsertedNew ? CT_NEW : CT_UPDATED);
index bacfd89..db035e5 100644 (file)
@@ -173,7 +173,7 @@ public:
     bool AddToWallet(const CWalletTx& wtxIn);
     bool AddToWalletIfInvolvingMe(const uint256 &hash, const CTransaction& tx, const CBlock* pblock, bool fUpdate = false, bool fFindBlock = false);
     bool EraseFromWallet(uint256 hash);
-    void WalletUpdateSpent(const CTransaction& prevout);
+    void WalletUpdateSpent(const CTransaction& prevout, bool fBlock = false);
     int ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate = false);
     void ReacceptWalletTransactions();
     void ResendWalletTransactions();