aboutsummaryrefslogtreecommitdiff
path: root/src/main.h
diff options
context:
space:
mode:
authorMatt Corallo <git@bluematt.me>2015-10-02 14:19:55 -0700
committerMatt Corallo <git@bluematt.me>2015-10-13 01:39:27 -0700
commit794a8cec5db84fde1cce82ada51740070ec188ac (patch)
tree35b6750a3dc813c635fb304f9d7658b2695edb70 /src/main.h
parente6c7b362ab8915e2aac167fa519bd29836d482af (diff)
downloadbitcoin-794a8cec5db84fde1cce82ada51740070ec188ac.tar.xz
Implement on-the-fly mempool size limitation.
After each transaction which is added to mempool, we first call Expire() to remove old transactions, then throwing away the lowest-feerate transactions. After throwing away transactions by feerate, we set the minimum relay fee to the maximum fee transaction-and-dependant-set we removed, plus the default minimum relay fee. After the next block is received, the minimum relay fee is allowed to decrease exponentially. Its halflife defaults to 12 hours, but is decreased to 6 hours if the mempool is smaller than half its maximum size, and 3 hours if the mempool is smaller than a quarter its maximum size. The minimum -maxmempool size is 40*-limitdescendantsize, as it is easy for an attacker to play games with the cheapest -limitdescendantsize transactions. -maxmempool defaults to 300MB. This disables high-priority transaction relay when the min relay fee adjustment is >0 (ie when the mempool is full). When the relay fee adjustment drops below the default minimum relay fee / 2 it is set to 0 (re-enabling priority-based free relay).
Diffstat (limited to 'src/main.h')
-rw-r--r--src/main.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/main.h b/src/main.h
index ec7cc2fdc6..be0d2bf47d 100644
--- a/src/main.h
+++ b/src/main.h
@@ -51,6 +51,8 @@ static const unsigned int DEFAULT_ANCESTOR_SIZE_LIMIT = 900;
static const unsigned int DEFAULT_DESCENDANT_LIMIT = 1000;
/** Default for -limitdescendantsize, maximum kilobytes of in-mempool descendants */
static const unsigned int DEFAULT_DESCENDANT_SIZE_LIMIT = 2500;
+/** Default for -maxmempool, maximum megabytes of mempool memory usage */
+static const unsigned int DEFAULT_MAX_MEMPOOL_SIZE = 300;
/** Default for -mempoolexpiry, expiration time for mempool transactions in hours */
static const unsigned int DEFAULT_MEMPOOL_EXPIRY = 72;
/** The maximum size of a blk?????.dat file (since 0.8) */