Merge branch '0.5.0.x' into 0.5.x
authorLuke Dashjr <luke-jr+git@utopios.org>
Tue, 27 Mar 2012 00:07:28 +0000 (20:07 -0400)
committerLuke Dashjr <luke-jr+git@utopios.org>
Tue, 27 Mar 2012 00:07:28 +0000 (20:07 -0400)
bitcoin-qt.pro
doc/translation_process.md
share/setup.nsi
src/db.cpp
src/main.cpp
src/net.cpp

index d46a6e7..60f1de8 100644 (file)
@@ -204,7 +204,7 @@ CODECFORTR = UTF-8
 TRANSLATIONS = $$files(src/qt/locale/bitcoin_*.ts)
 
 isEmpty(QMAKE_LRELEASE) {
-    win32:QMAKE_LRELEASE = $$[QT_INSTALL_BINS]\lrelease.exe
+    win32:QMAKE_LRELEASE = $$[QT_INSTALL_BINS]\\lrelease.exe
     else:QMAKE_LRELEASE = $$[QT_INSTALL_BINS]/lrelease
 }
 isEmpty(TS_DIR):TS_DIR = src/qt/locale
@@ -251,10 +251,20 @@ isEmpty(BOOST_INCLUDE_PATH) {
     macx:BOOST_INCLUDE_PATH = /opt/local/include
 }
 
-windows:LIBS += -lmingwthrd -lws2_32
-windows:DEFINES += _MT WIN32
+windows:LIBS += -lws2_32
+windows:DEFINES += WIN32
 windows:RC_FILE = src/qt/res/bitcoin-qt.rc
-windows:QMAKE_LIBS_QT_ENTRY -= -lmingw32
+
+windows:!contains(MINGW_THREAD_BUGFIX, 0) {
+    # At least qmake's win32-g++-cross profile is missing the -lmingwthrd
+    # thread-safety flag. GCC has -mthreads to enable this, but it doesn't
+    # work with static linking. -lmingwthrd must come BEFORE -lmingw, so
+    # it is prepended to QMAKE_LIBS_QT_ENTRY.
+    # It can be turned off with MINGW_THREAD_BUGFIX=0, just in case it causes
+    # any problems on some untested qmake profile now or in the future.
+    DEFINES += _MT
+    QMAKE_LIBS_QT_ENTRY = -lmingwthrd $$QMAKE_LIBS_QT_ENTRY
+}
 
 macx:HEADERS += src/qt/macdockiconhandler.h
 macx:OBJECTIVE_SOURCES += src/qt/macdockiconhandler.mm
index cf10005..603d557 100644 (file)
@@ -1,7 +1,7 @@
 Translations
 ============
 
-The QT GUI can be easily be translated into other languages. Here's how we
+The Qt GUI can be easily translated into other languages. Here's how we
 handle those translations.
 
 Files and Folders
@@ -30,10 +30,10 @@ This directory contains all translations. Filenames must adhere to this format:
 
 #### Source file
 
-`src/qt/locale/bitcoin_en.ts` is a treated in a special way. It is used as the
-source for all other translations. Whenever a string in the code is change
+`src/qt/locale/bitcoin_en.ts` is treated in a special way. It is used as the
+source for all other translations. Whenever a string in the code is changed
 this file must be updated to reflect those changes. Usually, this can be
-accomplished by running `lupdate`
+accomplished by running `lupdate`.
 
 Syncing with transifex
 ----------------------
@@ -42,9 +42,9 @@ We are using http://transifex.net as a frontend for translating the client.
 
 https://www.transifex.net/projects/p/bitcoin/resource/tx/
 
-The "transifex client":http://help.transifex.net/features/client/index.html
-will help with fetching new translations from transifex.
-
+The "transifex client" (see: http://help.transifex.net/features/client/)
+will help with fetching new translations from transifex. Use the following
+config to be able to connect with the client.
 
 ### .tx/config
 
index 38f0a3a..e231436 100644 (file)
@@ -75,6 +75,10 @@ Section -Main SEC0000
     File /r /x *.exe /x *.o ../src\*.*\r
     SetOutPath $INSTDIR\r
     WriteRegStr HKCU "${REGKEY}\Components" Main 1\r
+\r
+    # Remove old wxwidgets-based-bitcoin executable and locales:\r
+    Delete /REBOOTOK $INSTDIR\bitcoin.exe\r
+    RMDir /r /REBOOTOK $INSTDIR\locale\r
 SectionEnd\r
 \r
 Section -post SEC0001\r
index 9d5b33a..9b67ab6 100644 (file)
@@ -777,6 +777,13 @@ int CWalletDB::LoadWallet(CWallet* pwallet)
     //// todo: shouldn't we catch exceptions and try to recover and continue?
     CRITICAL_BLOCK(pwallet->cs_wallet)
     {
+        int nMinVersion = 0;
+        if (Read((string)"minversion", nMinVersion))
+        {
+            if (nMinVersion > VERSION)
+                return DB_TOO_NEW;
+        }
+
         // Get cursor
         Dbc* pcursor = GetCursor();
         if (!pcursor)
@@ -962,13 +969,6 @@ int CWalletDB::LoadWallet(CWallet* pwallet)
                 if (strKey == "addrProxy")          ssValue >> addrProxy;
                 if (fHaveUPnP && strKey == "fUseUPnP")           ssValue >> fUseUPnP;
             }
-            else if (strType == "minversion")
-            {
-                int nMinVersion = 0;
-                ssValue >> nMinVersion;
-                if (nMinVersion > VERSION)
-                    return DB_TOO_NEW;
-            }
         }
         pcursor->close();
     }
index 54a039f..3c5fef2 100644 (file)
@@ -1279,6 +1279,9 @@ bool static Reorganize(CTxDB& txdb, CBlockIndex* pindexNew)
         vConnect.push_back(pindex);
     reverse(vConnect.begin(), vConnect.end());
 
+    printf("REORGANIZE: Disconnect %i blocks; %s..%s\n", vDisconnect.size(), pfork->GetBlockHash().ToString().substr(0,20).c_str(), pindexBest->GetBlockHash().ToString().substr(0,20).c_str());
+    printf("REORGANIZE: Connect %i blocks; %s..%s\n", vConnect.size(), pfork->GetBlockHash().ToString().substr(0,20).c_str(), pindexNew->GetBlockHash().ToString().substr(0,20).c_str());
+
     // Disconnect shorter branch
     vector<CTransaction> vResurrect;
     BOOST_FOREACH(CBlockIndex* pindex, vDisconnect)
@@ -1287,7 +1290,7 @@ bool static Reorganize(CTxDB& txdb, CBlockIndex* pindexNew)
         if (!block.ReadFromDisk(pindex))
             return error("Reorganize() : ReadFromDisk for disconnect failed");
         if (!block.DisconnectBlock(txdb, pindex))
-            return error("Reorganize() : DisconnectBlock failed");
+            return error("Reorganize() : DisconnectBlock %s failed", pindex->GetBlockHash().ToString().substr(0,20).c_str());
 
         // Queue memory transactions to resurrect
         BOOST_FOREACH(const CTransaction& tx, block.vtx)
@@ -1307,7 +1310,7 @@ bool static Reorganize(CTxDB& txdb, CBlockIndex* pindexNew)
         {
             // Invalid block
             txdb.TxnAbort();
-            return error("Reorganize() : ConnectBlock failed");
+            return error("Reorganize() : ConnectBlock %s failed", pindex->GetBlockHash().ToString().substr(0,20).c_str());
         }
 
         // Queue memory transactions to delete
@@ -1339,6 +1342,8 @@ bool static Reorganize(CTxDB& txdb, CBlockIndex* pindexNew)
     BOOST_FOREACH(CTransaction& tx, vDelete)
         tx.RemoveFromMemoryPool();
 
+    printf("REORGANIZE: done\n");
+
     return true;
 }
 
@@ -1536,10 +1541,11 @@ bool CBlock::AcceptBlock()
         return error("AcceptBlock() : AddToBlockIndex failed");
 
     // Relay inventory, but don't relay old inventory during initial block download
+    int nBlockEstimate = Checkpoints::GetTotalBlocksEstimate();
     if (hashBestChain == hash)
         CRITICAL_BLOCK(cs_vNodes)
             BOOST_FOREACH(CNode* pnode, vNodes)
-                if (nBestHeight > (pnode->nStartingHeight != -1 ? pnode->nStartingHeight - 2000 : 140700))
+                if (nBestHeight > (pnode->nStartingHeight != -1 ? pnode->nStartingHeight - 2000 : nBlockEstimate))
                     pnode->PushInventory(CInv(MSG_BLOCK, hash));
 
     return true;
index f37c675..9a7bf78 100644 (file)
@@ -716,6 +716,7 @@ void CNode::CloseSocketDisconnect()
         printf("disconnecting node %s\n", addr.ToString().c_str());
         closesocket(hSocket);
         hSocket = INVALID_SOCKET;
+        vRecv.clear();
     }
 }