Merge pull request #677 from luke-jr/minfee_modes
authorGavin Andresen <gavinandresen@gmail.com>
Tue, 20 Dec 2011 21:09:18 +0000 (13:09 -0800)
committerGavin Andresen <gavinandresen@gmail.com>
Tue, 20 Dec 2011 21:09:18 +0000 (13:09 -0800)
API: GetMinFee modes

1  2 
src/main.cpp
src/main.h
src/wallet.cpp

diff --cc src/main.cpp
@@@ -495,15 -417,9 +495,15 @@@ bool CTransaction::AcceptToMemoryPool(C
                  *pfMissingInputs = true;
              return error("AcceptToMemoryPool() : ConnectInputs failed %s", hash.ToString().substr(0,10).c_str());
          }
 +        // Checking ECDSA signatures is a CPU bottleneck, so to avoid denial-of-service
 +        // attacks disallow transactions with more than one SigOp per 65 bytes.
 +        // 65 bytes because that is the minimum size of an ECDSA signature
 +        unsigned int nSize = ::GetSerializeSize(*this, SER_NETWORK);
 +        if (nSigOps > nSize / 65 || nSize < 100)
 +            return error("AcceptToMemoryPool() : transaction with out-of-bounds SigOpCount");
  
          // Don't accept it if it can't get into a block
-         if (nFees < GetMinFee(1000, true, true))
+         if (nFees < GetMinFee(1000, true, GMF_RELAY))
              return error("AcceptToMemoryPool() : not enough fees");
  
          // Continuously rate-limit free transactions
diff --cc src/main.h
Simple merge
diff --cc src/wallet.cpp
Simple merge