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.
This commit is contained in:
stickies-v 2022-09-15 18:26:21 +01:00
parent 2d8d9aecac
commit b85af25f87
No known key found for this signature in database
GPG key ID: 5CB1CE6E5E66A757

View file

@ -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