move-only: Create src/kernel/mempool_removal_reason.h

This is needed for a future commit. Can be reviewed with:
--color-moved=dimmed-zebra
This commit is contained in:
MarcoFalke 2023-08-02 15:51:00 +02:00
parent fa57608800
commit fad8c36aa9
No known key found for this signature in database
5 changed files with 52 additions and 31 deletions

View file

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

View file

@ -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);
}

View file

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

View file

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

View file

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