Merge branch '0.4.x' into 0.5.x
authorLuke Dashjr <luke-jr+git@utopios.org>
Fri, 4 May 2012 18:55:15 +0000 (18:55 +0000)
committerLuke Dashjr <luke-jr+git@utopios.org>
Fri, 4 May 2012 18:55:15 +0000 (18:55 +0000)
1  2 
src/main.cpp
src/serialize.h
src/util.cpp
src/wallet.h

diff --cc src/main.cpp
@@@ -1490,21 -1470,21 +1490,31 @@@ bool CBlock::CheckBlock() cons
      // Check transactions
      BOOST_FOREACH(const CTransaction& tx, vtx)
          if (!tx.CheckTransaction())
 -            return error("CheckBlock() : CheckTransaction failed");
 +            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");
      // Check that it's not full of nonstandard transactions
      if (GetSigOpCount() > MAX_BLOCK_SIGOPS)
 -        return error("CheckBlock() : out-of-bounds SigOpCount");
 +        return DoS(100, error("CheckBlock() : out-of-bounds SigOpCount"));
  
      // Check merkleroot
      if (hashMerkleRoot != BuildMerkleTree())
diff --cc src/serialize.h
Simple merge
diff --cc src/util.cpp
Simple merge
diff --cc src/wallet.h
Simple merge