diff options
author | stickies-v <stickies-v@protonmail.com> | 2022-09-15 18:26:21 +0100 |
---|---|---|
committer | stickies-v <stickies-v@protonmail.com> | 2022-10-05 13:07:11 +0100 |
commit | b85af25f8770974bae4ef3fae64e75ef6dd2d3c2 (patch) | |
tree | a49dc5404258fa3ac1f68cb68e1ba45f6076c0e3 /src/kernel/mempool_limits.h | |
parent | 2d8d9aecacfe5a5c3bce7807845456d82c674aa5 (diff) |
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/kernel/mempool_limits.h')
-rw-r--r-- | src/kernel/mempool_limits.h | 9 |
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 |