Add new (unused) limits for cluster size/count

This commit is contained in:
Suhas Daftuar
2023-09-21 06:17:40 -04:00
parent 838d7e3553
commit 34e32985e8
4 changed files with 20 additions and 1 deletions

View File

@@ -15,6 +15,7 @@
#include <policy/feerate.h>
#include <policy/policy.h>
#include <tinyformat.h>
#include <txgraph.h>
#include <util/moneystr.h>
#include <util/translation.h>
@@ -31,6 +32,10 @@ static constexpr int MAX_32BIT_MEMPOOL_MB{500};
namespace {
void ApplyArgsManOptions(const ArgsManager& argsman, MemPoolLimits& mempool_limits)
{
mempool_limits.cluster_count = argsman.GetIntArg("-limitclustercount", mempool_limits.cluster_count);
if (auto vkb = argsman.GetIntArg("-limitclustersize")) mempool_limits.cluster_size_vbytes = *vkb * 1'000;
mempool_limits.ancestor_count = argsman.GetIntArg("-limitancestorcount", mempool_limits.ancestor_count);
if (auto vkb = argsman.GetIntArg("-limitancestorsize")) mempool_limits.ancestor_size_vbytes = *vkb * 1'000;
@@ -106,5 +111,9 @@ util::Result<void> ApplyArgsManOptions(const ArgsManager& argsman, const CChainP
ApplyArgsManOptions(argsman, mempool_opts.limits);
if (mempool_opts.limits.cluster_count > MAX_CLUSTER_COUNT_LIMIT) {
return util::Error{Untranslated(strprintf("limitclustercount must be less than or equal to %d", MAX_CLUSTER_COUNT_LIMIT))};
}
return {};
}