From e6578e7fa7385dde7a0de9c2e87d8c0afa176314 Mon Sep 17 00:00:00 2001 From: Philip Kaufmann Date: Tue, 1 May 2012 01:56:47 +0200 Subject: [PATCH 1/4] remove unused typedef in serialize.h --- src/serialize.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/serialize.h b/src/serialize.h index 302766062ab..959a3a694ba 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -1244,8 +1244,6 @@ public: int nType; int nVersion; - typedef FILE element_type; - CAutoFile(FILE* filenew=NULL, int nTypeIn=SER_DISK, int nVersionIn=VERSION) { file = filenew; From 48984829151d76fefb62029e500145d7e4f19a8d Mon Sep 17 00:00:00 2001 From: Philip Kaufmann Date: Tue, 1 May 2012 01:46:03 +0200 Subject: [PATCH 2/4] fix compiler warning "suggest parentheses around assignment used as truth value [-Wparentheses]" in util.cpp --- src/util.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util.cpp b/src/util.cpp index a45d19156f1..766c3ab4477 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -236,7 +236,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; From cae1a682678e94015ff89be2c6fa6484c8ef6fbe Mon Sep 17 00:00:00 2001 From: Philip Kaufmann Date: Thu, 3 May 2012 11:30:52 +0200 Subject: [PATCH 3/4] remove obsolete BackupWallet() entry in wallet.h --- src/wallet.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/wallet.h b/src/wallet.h index e0f39b4170a..ea7b279268d 100644 --- a/src/wallet.h +++ b/src/wallet.h @@ -166,7 +166,6 @@ public: } int LoadWallet(bool& fFirstRunRet); -// bool BackupWallet(const std::string& strDest); bool SetAddressBookName(const CBitcoinAddress& address, const std::string& strName); From ad5a4c7c471912aa0bef52c33a1abfb01fe6d89d Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Sun, 29 Apr 2012 20:56:55 -0400 Subject: [PATCH 4/4] Check earlier for blocks with duplicate transactions. Fixes #1167 --- src/main.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index e6f94210b98..e8cbc01c7f0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1472,6 +1472,16 @@ bool CBlock::CheckBlock() const if (!tx.CheckTransaction()) return 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 error("CheckBlock() : duplicate transaction"); + // Check that it's not full of nonstandard transactions if (GetSigOpCount() > MAX_BLOCK_SIGOPS) return error("CheckBlock() : out-of-bounds SigOpCount");