aboutsummaryrefslogtreecommitdiff
path: root/src/validation.cpp
diff options
context:
space:
mode:
authorJeremy Rubin <j@rubin.io>2021-03-17 14:11:44 -0700
committerJeremy Rubin <j@rubin.io>2021-12-08 23:07:56 -0800
commitc5b36b1c1b11f04e5da7fb44183f61d09a14e40d (patch)
tree4688cf0ac226383e90a3515ded16275ad07b9fd4 /src/validation.cpp
parentc49daf9885e86ba08acdc8332d2a34bc5951a487 (diff)
Mempool Update Cut-Through Optimization
Often when we're updating mempool entries we update entries that we ultimately end up removing the updated entries shortly thereafter. This patch makes it so that we filter for such entries a bit earlier in processing, which yields a mild improvement for these cases, and is negligible overhead otherwise.
Diffstat (limited to 'src/validation.cpp')
-rw-r--r--src/validation.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/validation.cpp b/src/validation.cpp
index 7efd176e00..f40941ad08 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -348,7 +348,9 @@ void CChainState::MaybeUpdateMempoolForReorg(
// previously-confirmed transactions back to the mempool.
// UpdateTransactionsFromBlock finds descendants of any transactions in
// the disconnectpool that were added back and cleans up the mempool state.
- m_mempool->UpdateTransactionsFromBlock(vHashUpdate);
+ const uint64_t ancestor_count_limit = gArgs.GetIntArg("-limitancestorcount", DEFAULT_ANCESTOR_LIMIT);
+ const uint64_t ancestor_size_limit = gArgs.GetIntArg("-limitancestorsize", DEFAULT_ANCESTOR_SIZE_LIMIT) * 1000;
+ m_mempool->UpdateTransactionsFromBlock(vHashUpdate, ancestor_size_limit, ancestor_count_limit);
const auto check_final_and_mature = [this, flags=STANDARD_LOCKTIME_VERIFY_FLAGS](CTxMemPool::txiter it)
EXCLUSIVE_LOCKS_REQUIRED(m_mempool->cs, ::cs_main) {