Browse Source

Increase maximum orphan size to 100,000 bytes.

Although this increases node memory usage in the worst case by perhaps
 30MB, the current behavior causes severe issues with dependent tx relay.
0.13
Gregory Maxwell 8 years ago
parent
commit
54326a6808
  1. 6
      src/main.cpp
  2. 2
      src/test/DoS_tests.cpp

6
src/main.cpp

@ -633,10 +633,10 @@ bool AddOrphanTx(const CTransaction& tx, NodeId peer) EXCLUSIVE_LOCKS_REQUIRED(c
// large transaction with a missing parent then we assume // large transaction with a missing parent then we assume
// it will rebroadcast it later, after the parent transaction(s) // it will rebroadcast it later, after the parent transaction(s)
// have been mined or received. // have been mined or received.
// 10,000 orphans, each of which is at most 5,000 bytes big is // 100 orphans, each of which is at most 99,999 bytes big is
// at most 500 megabytes of orphans: // at most 10 megabytes of orphans and somewhat more byprev index (in the worst case):
unsigned int sz = tx.GetSerializeSize(SER_NETWORK, CTransaction::CURRENT_VERSION); unsigned int sz = tx.GetSerializeSize(SER_NETWORK, CTransaction::CURRENT_VERSION);
if (sz > 5000) if (sz >= MAX_STANDARD_TX_SIZE)
{ {
LogPrint("mempool", "ignoring large orphan tx (size: %u, hash: %s)\n", sz, hash.ToString()); LogPrint("mempool", "ignoring large orphan tx (size: %u, hash: %s)\n", sz, hash.ToString());
return false; return false;

2
src/test/DoS_tests.cpp

@ -162,7 +162,7 @@ BOOST_AUTO_TEST_CASE(DoS_mapOrphans)
tx.vout.resize(1); tx.vout.resize(1);
tx.vout[0].nValue = 1*CENT; tx.vout[0].nValue = 1*CENT;
tx.vout[0].scriptPubKey = GetScriptForDestination(key.GetPubKey().GetID()); tx.vout[0].scriptPubKey = GetScriptForDestination(key.GetPubKey().GetID());
tx.vin.resize(500); tx.vin.resize(2777);
for (unsigned int j = 0; j < tx.vin.size(); j++) for (unsigned int j = 0; j < tx.vin.size(); j++)
{ {
tx.vin[j].prevout.n = j; tx.vin[j].prevout.n = j;

Loading…
Cancel
Save