diff options
author | Carl Dong <contact@carldong.me> | 2022-03-17 22:09:05 -0400 |
---|---|---|
committer | Carl Dong <contact@carldong.me> | 2022-06-28 15:46:10 -0400 |
commit | 9333427014695ac235c96d48791098168dfdc9db (patch) | |
tree | 07ad5f9e9837a97418739be0a09e896a3ced829e /src/mempool_args.cpp | |
parent | 716bb5fbd31077bbe99d11a54d6c2c250afc8085 (diff) | |
download | bitcoin-9333427014695ac235c96d48791098168dfdc9db.tar.xz |
mempool: Introduce (still-unused) MemPoolLimits
They live as a CTxMemPool member.
[META] These limits will be used in subsequent commits to replace calls
to gArgs.
Diffstat (limited to 'src/mempool_args.cpp')
-rw-r--r-- | src/mempool_args.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/mempool_args.cpp b/src/mempool_args.cpp index 06d553cf44..e26cbe0275 100644 --- a/src/mempool_args.cpp +++ b/src/mempool_args.cpp @@ -4,12 +4,27 @@ #include <mempool_args.h> +#include <kernel/mempool_limits.h> #include <kernel/mempool_options.h> #include <util/system.h> +using kernel::MemPoolLimits; using kernel::MemPoolOptions; +namespace { +void ApplyArgsManOptions(const ArgsManager& argsman, MemPoolLimits& mempool_limits) +{ + 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; + + mempool_limits.descendant_count = argsman.GetIntArg("-limitdescendantcount", mempool_limits.descendant_count); + + if (auto vkb = argsman.GetIntArg("-limitdescendantsize")) mempool_limits.descendant_size_vbytes = *vkb * 1'000; +} +} + void ApplyArgsManOptions(const ArgsManager& argsman, MemPoolOptions& mempool_opts) { mempool_opts.check_ratio = argsman.GetIntArg("-checkmempool", mempool_opts.check_ratio); @@ -17,4 +32,6 @@ void ApplyArgsManOptions(const ArgsManager& argsman, MemPoolOptions& mempool_opt if (auto mb = argsman.GetIntArg("-maxmempool")) mempool_opts.max_size_bytes = *mb * 1'000'000; if (auto hours = argsman.GetIntArg("-mempoolexpiry")) mempool_opts.expiry = std::chrono::hours{*hours}; + + ApplyArgsManOptions(argsman, mempool_opts.limits); } |