aboutsummaryrefslogtreecommitdiff
path: root/src/kernel
diff options
context:
space:
mode:
authorCarl Dong <contact@carldong.me>2022-03-17 22:09:05 -0400
committerCarl Dong <contact@carldong.me>2022-06-28 15:46:10 -0400
commit9333427014695ac235c96d48791098168dfdc9db (patch)
tree07ad5f9e9837a97418739be0a09e896a3ced829e /src/kernel
parent716bb5fbd31077bbe99d11a54d6c2c250afc8085 (diff)
downloadbitcoin-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/kernel')
-rw-r--r--src/kernel/mempool_limits.h26
-rw-r--r--src/kernel/mempool_options.h3
2 files changed, 29 insertions, 0 deletions
diff --git a/src/kernel/mempool_limits.h b/src/kernel/mempool_limits.h
new file mode 100644
index 0000000000..083e9681e7
--- /dev/null
+++ b/src/kernel/mempool_limits.h
@@ -0,0 +1,26 @@
+// Copyright (c) 2022 The Bitcoin Core developers
+// Distributed under the MIT software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+#ifndef BITCOIN_KERNEL_MEMPOOL_LIMITS_H
+#define BITCOIN_KERNEL_MEMPOOL_LIMITS_H
+
+#include <policy/policy.h>
+
+#include <cstdint>
+
+namespace kernel {
+/**
+ * Options struct containing limit options for a CTxMemPool. Default constructor
+ * populates the struct with sane default values which can be modified.
+ *
+ * Most of the time, this struct should be referenced as CTxMemPool::Limits.
+ */
+struct MemPoolLimits {
+ int64_t ancestor_count{DEFAULT_ANCESTOR_LIMIT};
+ int64_t ancestor_size_vbytes{DEFAULT_ANCESTOR_SIZE_LIMIT_KVB * 1'000};
+ int64_t descendant_count{DEFAULT_DESCENDANT_LIMIT};
+ int64_t descendant_size_vbytes{DEFAULT_DESCENDANT_SIZE_LIMIT_KVB * 1'000};
+};
+} // namespace kernel
+
+#endif // BITCOIN_KERNEL_MEMPOOL_LIMITS_H
diff --git a/src/kernel/mempool_options.h b/src/kernel/mempool_options.h
index c4f34ff9f9..a14abb6628 100644
--- a/src/kernel/mempool_options.h
+++ b/src/kernel/mempool_options.h
@@ -4,6 +4,8 @@
#ifndef BITCOIN_KERNEL_MEMPOOL_OPTIONS_H
#define BITCOIN_KERNEL_MEMPOOL_OPTIONS_H
+#include <kernel/mempool_limits.h>
+
#include <chrono>
#include <cstdint>
@@ -29,6 +31,7 @@ struct MemPoolOptions {
int check_ratio{0};
int64_t max_size_bytes{DEFAULT_MAX_MEMPOOL_SIZE_MB * 1'000'000};
std::chrono::seconds expiry{std::chrono::hours{DEFAULT_MEMPOOL_EXPIRY_HOURS}};
+ MemPoolLimits limits{};
};
} // namespace kernel