Skip to content

Commit 54326a6

Browse files
committed
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.
1 parent 8c99d1b commit 54326a6

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/main.cpp

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

src/test/DoS_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ BOOST_AUTO_TEST_CASE(DoS_mapOrphans)
162162
tx.vout.resize(1);
163163
tx.vout[0].nValue = 1*CENT;
164164
tx.vout[0].scriptPubKey = GetScriptForDestination(key.GetPubKey().GetID());
165-
tx.vin.resize(500);
165+
tx.vin.resize(2777);
166166
for (unsigned int j = 0; j < tx.vin.size(); j++)
167167
{
168168
tx.vin[j].prevout.n = j;

0 commit comments

Comments
 (0)