aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2014-09-10 14:08:03 -0400
committerWladimir J. van der Laan <laanwj@gmail.com>2014-09-11 15:06:46 +0200
commitea3c1b0806f4d117ed6284e2d943f1f125884591 (patch)
tree0b56c4f5f1b2ae07c036e24e649452c93d88a054 /src/main.cpp
parentaf252082ef03f72be782cb9c97d357da095f066f (diff)
downloadbitcoin-ea3c1b0806f4d117ed6284e2d943f1f125884591.tar.xz
Store fewer orphan tx by default, add -maxorphantx option
There is no reason to store thousands of orphan transactions; normally an orphan's parents will either be broadcast or mined reasonably quickly. This pull drops the maximum number of orphans from 10,000 down to 100, and adds a command-line option (-maxorphantx) that is just like -maxorphanblocks to override the default.
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 6581b7d87a..d1726904b6 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -3819,7 +3819,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
AddOrphanTx(tx, pfrom->GetId());
// DoS prevention: do not allow mapOrphanTransactions to grow unbounded
- unsigned int nEvicted = LimitOrphanTxSize(MAX_ORPHAN_TRANSACTIONS);
+ unsigned int nMaxOrphanTx = (unsigned int)std::max((int64_t)0, GetArg("-maxorphantx", DEFAULT_MAX_ORPHAN_TRANSACTIONS));
+ unsigned int nEvicted = LimitOrphanTxSize(nMaxOrphanTx);
if (nEvicted > 0)
LogPrint("mempool", "mapOrphan overflow, removed %u tx\n", nEvicted);
}