changeset 2964:3fdb45ee3bc2 draft

Merge branch '0.5.x' into 0.6.0.x Conflicts: src/main.cpp src/serialize.h
author Luke Dashjr <luke-jr+git@utopios.org>
date Fri, 04 May 2012 18:57:03 +0000
parents c75b347b2fc9 (current diff) 2cabaf34b929 (diff)
children 59540cc9d9d5
files bitcoin-qt.pro src/main.cpp src/serialize.h src/util.cpp src/wallet.h
diffstat 5 files changed, 23 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/bitcoin-qt.pro
+++ b/bitcoin-qt.pro
@@ -90,7 +90,7 @@
 QMAKE_CXXFLAGS_WARN_ON = -fdiagnostics-show-option -Wall -Wno-strict-aliasing -Wno-invalid-offsetof -Wno-unused-variable -Wno-unused-parameter -Wno-sign-compare -Wno-char-subscripts  -Wno-unused-value -Wno-sequence-point -Wno-parentheses -Wno-unknown-pragmas -Wno-switch
 
 # Input
-DEPENDPATH += src/qt src src json/include
+DEPENDPATH += src src/json src/qt
 HEADERS += src/qt/bitcoingui.h \
     src/qt/transactiontablemodel.h \
     src/qt/addresstablemodel.h \
@@ -261,7 +261,7 @@
 
 # "Other files" to show in Qt Creator
 OTHER_FILES += \
-    doc/*.rst doc/*.txt doc/README README.md
+    doc/*.rst doc/*.txt doc/README README.md res/bitcoin-qt.rc
 
 # platform specific defaults, if not overridden on command line
 isEmpty(BOOST_LIB_SUFFIX) {
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1659,6 +1659,26 @@
         if (!tx.CheckTransaction())
             return DoS(tx.nDoS, error("CheckBlock() : CheckTransaction failed"));
 
+    // Check for duplicate txids. This is caught by ConnectInputs(),
+    // but catching it earlier avoids a potential DoS attack:
+    set<uint256> uniqueTx;
+    BOOST_FOREACH(const CTransaction& tx, vtx)
+    {
+        uniqueTx.insert(tx.GetHash());
+    }
+    if (uniqueTx.size() != vtx.size())
+        return DoS(100, error("CheckBlock() : duplicate transaction"));
+
+    // Check for duplicate txids. This is caught by ConnectInputs(),
+    // but catching it earlier avoids a potential DoS attack:
+    set<uint256> uniqueTx;
+    BOOST_FOREACH(const CTransaction& tx, vtx)
+    {
+        uniqueTx.insert(tx.GetHash());
+    }
+    if (uniqueTx.size() != vtx.size())
+        return error("CheckBlock() : duplicate transaction");
+
     int nSigOps = 0;
     BOOST_FOREACH(const CTransaction& tx, vtx)
     {
--- a/src/serialize.h
+++ b/src/serialize.h
@@ -1234,8 +1234,6 @@
     int nType;
     int nVersion;
 
-    typedef FILE element_type;
-
     CAutoFile(FILE* filenew=NULL, int nTypeIn=SER_DISK, int nVersionIn=PROTOCOL_VERSION)
     {
         file = filenew;
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -237,7 +237,7 @@
             *pend = '\0';
             char* p1 = pszBuffer;
             char* p2;
-            while (p2 = strchr(p1, '\n'))
+            while ((p2 = strchr(p1, '\n')))
             {
                 p2++;
                 char c = *p2;
--- a/src/wallet.h
+++ b/src/wallet.h
@@ -203,7 +203,6 @@
     }
 
     int LoadWallet(bool& fFirstRunRet);
-//    bool BackupWallet(const std::string& strDest);
 
     bool SetAddressBookName(const CBitcoinAddress& address, const std::string& strName);