aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorstickies-v <stickies-v@protonmail.com>2022-09-15 18:26:21 +0100
committerstickies-v <stickies-v@protonmail.com>2022-10-05 13:07:11 +0100
commitb85af25f8770974bae4ef3fae64e75ef6dd2d3c2 (patch)
treea49dc5404258fa3ac1f68cb68e1ba45f6076c0e3 /src
parent2d8d9aecacfe5a5c3bce7807845456d82c674aa5 (diff)
downloadbitcoin-b85af25f8770974bae4ef3fae64e75ef6dd2d3c2.tar.xz
refactor: mempool: add MemPoolLimits::NoLimits()
There are quite a few places in the codebase that require us to construct a CTxMemPool without limits on ancestors and descendants. This helper function allows us to get rid of all that duplication.
Diffstat (limited to 'src')
-rw-r--r--src/kernel/mempool_limits.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/kernel/mempool_limits.h b/src/kernel/mempool_limits.h
index e192e7e6cd..8d4495c3cb 100644
--- a/src/kernel/mempool_limits.h
+++ b/src/kernel/mempool_limits.h
@@ -24,6 +24,15 @@ struct MemPoolLimits {
int64_t descendant_count{DEFAULT_DESCENDANT_LIMIT};
//! The maximum allowed size in virtual bytes of an entry and its descendants within a package.
int64_t descendant_size_vbytes{DEFAULT_DESCENDANT_SIZE_LIMIT_KVB * 1'000};
+
+ /**
+ * @return MemPoolLimits with all the limits set to the maximum
+ */
+ static constexpr MemPoolLimits NoLimits()
+ {
+ int64_t no_limit{std::numeric_limits<int64_t>::max()};
+ return {no_limit, no_limit, no_limit, no_limit};
+ }
};
} // namespace kernel