diff options
author | Gavin Andresen <gavinandresen@gmail.com> | 2013-02-05 07:12:27 -0800 |
---|---|---|
committer | Gavin Andresen <gavinandresen@gmail.com> | 2013-02-05 07:12:27 -0800 |
commit | 1d0851eca8917f1c3edaa51886c70353f03f8205 (patch) | |
tree | 06c58ca8ce31483651ce757ca00ab8de17317588 /src/main.cpp | |
parent | 0e2e4fdf27dff95d5a6663ccf770d39451848f84 (diff) | |
parent | 41e1a0d7663d479f437c779df90775fc2bbc4087 (diff) | |
download | bitcoin-1d0851eca8917f1c3edaa51886c70353f03f8205.tar.xz |
Merge pull request #2273 from gavinandresen/txsize
Make transactions larger than 100K non-standard
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp index 2b102e5b9d..df8f7efa22 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -362,6 +362,14 @@ bool CTransaction::IsStandard() const if (!IsFinal()) return false; + // Extremely large transactions with lots of inputs can cost the network + // almost as much to process as they cost the sender in fees, because + // computing signature hashes is O(ninputs*txsize). Limiting transactions + // to MAX_STANDARD_TX_SIZE mitigates CPU exhaustion attacks. + unsigned int sz = this->GetSerializeSize(SER_NETWORK, CTransaction::CURRENT_VERSION); + if (sz >= MAX_STANDARD_TX_SIZE) + return false; + BOOST_FOREACH(const CTxIn& txin, vin) { // Biggest 'standard' txin is a 3-signature 3-of-3 CHECKMULTISIG |