aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Makefile.am3
-rw-r--r--src/kernel/mempool_removal_reason.cpp21
-rw-r--r--src/kernel/mempool_removal_reason.h24
-rw-r--r--src/txmempool.cpp13
-rw-r--r--src/txmempool.h22
5 files changed, 52 insertions, 31 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 1f953ab624..feed4a0061 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -190,6 +190,7 @@ BITCOIN_CORE_H = \
kernel/mempool_limits.h \
kernel/mempool_options.h \
kernel/mempool_persist.h \
+ kernel/mempool_removal_reason.h \
kernel/notifications_interface.h \
kernel/validation_cache_sizes.h \
key.h \
@@ -401,6 +402,7 @@ libbitcoin_node_a_SOURCES = \
kernel/context.cpp \
kernel/cs_main.cpp \
kernel/mempool_persist.cpp \
+ kernel/mempool_removal_reason.cpp \
mapport.cpp \
net.cpp \
net_processing.cpp \
@@ -940,6 +942,7 @@ libbitcoinkernel_la_SOURCES = \
kernel/context.cpp \
kernel/cs_main.cpp \
kernel/mempool_persist.cpp \
+ kernel/mempool_removal_reason.cpp \
key.cpp \
logging.cpp \
node/blockstorage.cpp \
diff --git a/src/kernel/mempool_removal_reason.cpp b/src/kernel/mempool_removal_reason.cpp
new file mode 100644
index 0000000000..df27590c7a
--- /dev/null
+++ b/src/kernel/mempool_removal_reason.cpp
@@ -0,0 +1,21 @@
+// Copyright (c) 2016-present The Bitcoin Core developers
+// Distributed under the MIT software license, see the accompanying
+// file COPYING or https://opensource.org/license/mit/.
+
+#include <kernel/mempool_removal_reason.h>
+
+#include <cassert>
+#include <string>
+
+std::string RemovalReasonToString(const MemPoolRemovalReason& r) noexcept
+{
+ switch (r) {
+ case MemPoolRemovalReason::EXPIRY: return "expiry";
+ case MemPoolRemovalReason::SIZELIMIT: return "sizelimit";
+ case MemPoolRemovalReason::REORG: return "reorg";
+ case MemPoolRemovalReason::BLOCK: return "block";
+ case MemPoolRemovalReason::CONFLICT: return "conflict";
+ case MemPoolRemovalReason::REPLACED: return "replaced";
+ }
+ assert(false);
+}
diff --git a/src/kernel/mempool_removal_reason.h b/src/kernel/mempool_removal_reason.h
new file mode 100644
index 0000000000..53c2ff1c31
--- /dev/null
+++ b/src/kernel/mempool_removal_reason.h
@@ -0,0 +1,24 @@
+// Copyright (c) 2016-present The Bitcoin Core developers
+// Distributed under the MIT software license, see the accompanying
+// file COPYING or https://opensource.org/license/mit/.
+
+#ifndef BITCOIN_KERNEL_MEMPOOL_REMOVAL_REASON_H
+#define BITCOIN_KERNEL_MEMPOOL_REMOVAL_REASON_H
+
+#include <string>
+
+/** Reason why a transaction was removed from the mempool,
+ * this is passed to the notification signal.
+ */
+enum class MemPoolRemovalReason {
+ EXPIRY, //!< Expired from mempool
+ SIZELIMIT, //!< Removed in size limiting
+ REORG, //!< Removed for reorganization
+ BLOCK, //!< Removed for block
+ CONFLICT, //!< Removed for conflict with in-block transaction
+ REPLACED, //!< Removed for replacement
+};
+
+std::string RemovalReasonToString(const MemPoolRemovalReason& r) noexcept;
+
+#endif // BITCOIN_KERNEL_MEMPOOL_REMOVAL_REASON_H
diff --git a/src/txmempool.cpp b/src/txmempool.cpp
index 497a41d6a9..226dd9f353 100644
--- a/src/txmempool.cpp
+++ b/src/txmempool.cpp
@@ -1197,19 +1197,6 @@ void CTxMemPool::SetLoadTried(bool load_tried)
m_load_tried = load_tried;
}
-std::string RemovalReasonToString(const MemPoolRemovalReason& r) noexcept
-{
- switch (r) {
- case MemPoolRemovalReason::EXPIRY: return "expiry";
- case MemPoolRemovalReason::SIZELIMIT: return "sizelimit";
- case MemPoolRemovalReason::REORG: return "reorg";
- case MemPoolRemovalReason::BLOCK: return "block";
- case MemPoolRemovalReason::CONFLICT: return "conflict";
- case MemPoolRemovalReason::REPLACED: return "replaced";
- }
- assert(false);
-}
-
std::vector<CTxMemPool::txiter> CTxMemPool::GatherClusters(const std::vector<uint256>& txids) const
{
AssertLockHeld(cs);
diff --git a/src/txmempool.h b/src/txmempool.h
index afaaf0d4d6..869612a4a2 100644
--- a/src/txmempool.h
+++ b/src/txmempool.h
@@ -6,14 +6,14 @@
#ifndef BITCOIN_TXMEMPOOL_H
#define BITCOIN_TXMEMPOOL_H
-#include <kernel/mempool_limits.h>
-#include <kernel/mempool_options.h>
-
#include <coins.h>
#include <consensus/amount.h>
#include <indirectmap.h>
#include <kernel/cs_main.h>
-#include <kernel/mempool_entry.h>
+#include <kernel/mempool_entry.h> // IWYU pragma: export
+#include <kernel/mempool_limits.h> // IWYU pragma: export
+#include <kernel/mempool_options.h> // IWYU pragma: export
+#include <kernel/mempool_removal_reason.h> // IWYU pragma: export
#include <policy/feerate.h>
#include <policy/packages.h>
#include <primitives/transaction.h>
@@ -225,20 +225,6 @@ struct TxMempoolInfo
int64_t nFeeDelta;
};
-/** Reason why a transaction was removed from the mempool,
- * this is passed to the notification signal.
- */
-enum class MemPoolRemovalReason {
- EXPIRY, //!< Expired from mempool
- SIZELIMIT, //!< Removed in size limiting
- REORG, //!< Removed for reorganization
- BLOCK, //!< Removed for block
- CONFLICT, //!< Removed for conflict with in-block transaction
- REPLACED, //!< Removed for replacement
-};
-
-std::string RemovalReasonToString(const MemPoolRemovalReason& r) noexcept;
-
/**
* CTxMemPool stores valid-according-to-the-current-best-chain transactions
* that may be included in the next block.