Skip to content

Commit b85af25

Browse files
committed
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.
1 parent 2d8d9ae commit b85af25

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/kernel/mempool_limits.h

+9
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ struct MemPoolLimits {
2424
int64_t descendant_count{DEFAULT_DESCENDANT_LIMIT};
2525
//! The maximum allowed size in virtual bytes of an entry and its descendants within a package.
2626
int64_t descendant_size_vbytes{DEFAULT_DESCENDANT_SIZE_LIMIT_KVB * 1'000};
27+
28+
/**
29+
* @return MemPoolLimits with all the limits set to the maximum
30+
*/
31+
static constexpr MemPoolLimits NoLimits()
32+
{
33+
int64_t no_limit{std::numeric_limits<int64_t>::max()};
34+
return {no_limit, no_limit, no_limit, no_limit};
35+
}
2736
};
2837
} // namespace kernel
2938

0 commit comments

Comments
 (0)