diff --git a/bitcoin-qt.pro b/bitcoin-qt.pro index db2bfe33d9f..5f2e7c1cab5 100644 --- a/bitcoin-qt.pro +++ b/bitcoin-qt.pro @@ -90,7 +90,7 @@ contains(BITCOIN_NEED_QT_PLUGINS, 1) { 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 @@ PRE_TARGETDEPS += compiler_TSQM_make_all # "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) { diff --git a/src/main.cpp b/src/main.cpp index 1bb64a62645..0599b25d161 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1659,6 +1659,26 @@ bool CBlock::CheckBlock() const 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 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 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) { diff --git a/src/serialize.h b/src/serialize.h index 25777fe3c5a..2cb3563f8f3 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -1234,8 +1234,6 @@ public: int nType; int nVersion; - typedef FILE element_type; - CAutoFile(FILE* filenew=NULL, int nTypeIn=SER_DISK, int nVersionIn=PROTOCOL_VERSION) { file = filenew; diff --git a/src/util.cpp b/src/util.cpp index 039c482f71f..bfc0eb81d4e 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -237,7 +237,7 @@ inline int OutputDebugStringF(const char* pszFormat, ...) *pend = '\0'; char* p1 = pszBuffer; char* p2; - while (p2 = strchr(p1, '\n')) + while ((p2 = strchr(p1, '\n'))) { p2++; char c = *p2; diff --git a/src/wallet.h b/src/wallet.h index 5672c6069dd..c6853456260 100644 --- a/src/wallet.h +++ b/src/wallet.h @@ -203,7 +203,6 @@ public: } int LoadWallet(bool& fFirstRunRet); -// bool BackupWallet(const std::string& strDest); bool SetAddressBookName(const CBitcoinAddress& address, const std::string& strName);