From: Gavin Andresen Date: Tue, 20 Dec 2011 21:09:18 +0000 (-0800) Subject: Merge pull request #677 from luke-jr/minfee_modes X-Git-Tag: v0.4.0-unstable~129^2~305 X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=commitdiff_plain;h=781c06c0f534913321a415a4fb64a60734e43101 Merge pull request #677 from luke-jr/minfee_modes API: GetMinFee modes --- 781c06c0f534913321a415a4fb64a60734e43101 diff --cc src/main.cpp index cfd6ac2,807279a..bef76f7 --- a/src/main.cpp +++ b/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