From e57980b4738c10344baf136de3e050a3cb958ca5 Mon Sep 17 00:00:00 2001 From: John Newbery Date: Mon, 11 Nov 2019 10:53:03 -0500 Subject: [PATCH] [mempool] Remove NotifyEntryAdded and NotifyEntryRemoved callbacks NotifyEntryAdded never had any subscribers so can be removed. Since ConnectTrace no longer subscribes to NotifyEntryRemoved, there are now no subscribers. The CValidationInterface TransactionAddedToMempool and TransactionRemovedFromMempool methods can now provide this functionality. There's no need for a special notifications framework for the mempool. --- src/init.cpp | 1 + src/interfaces/node.cpp | 2 ++ src/txmempool.cpp | 5 +---- src/txmempool.h | 4 ---- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index ece6214aa8f..bcc3d83af8f 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -74,6 +74,7 @@ #include #include #include +#include #include #if ENABLE_ZMQ diff --git a/src/interfaces/node.cpp b/src/interfaces/node.cpp index 8a64a9d26aa..b720a630179 100644 --- a/src/interfaces/node.cpp +++ b/src/interfaces/node.cpp @@ -37,6 +37,8 @@ #include +#include + class CWallet; fs::path GetWalletDir(); std::vector ListWalletDir(); diff --git a/src/txmempool.cpp b/src/txmempool.cpp index f04f13e6e00..47b0d39ea4c 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -355,7 +355,6 @@ void CTxMemPool::AddTransactionsUpdated(unsigned int n) void CTxMemPool::addUnchecked(const CTxMemPoolEntry &entry, setEntries &setAncestors, bool validFeeEstimate) { - NotifyEntryAdded(entry.GetSharedTx()); // Add to memory pool without checking anything. // Used by AcceptToMemoryPool(), which DOES do // all the appropriate checks. @@ -406,14 +405,12 @@ void CTxMemPool::addUnchecked(const CTxMemPoolEntry &entry, setEntries &setAnces void CTxMemPool::removeUnchecked(txiter it, MemPoolRemovalReason reason) { - CTransactionRef ptx = it->GetSharedTx(); - NotifyEntryRemoved(ptx, reason); if (reason != MemPoolRemovalReason::BLOCK) { // Notify clients that a transaction has been removed from the mempool // for any reason except being included in a block. Clients interested // in transactions included in blocks can subscribe to the BlockConnected // notification. - GetMainSignals().TransactionRemovedFromMempool(ptx); + GetMainSignals().TransactionRemovedFromMempool(it->GetSharedTx()); } const uint256 hash = it->GetTx().GetHash(); diff --git a/src/txmempool.h b/src/txmempool.h index de11d626b41..38a4667b317 100644 --- a/src/txmempool.h +++ b/src/txmempool.h @@ -27,7 +27,6 @@ #include #include #include -#include class CBlockIndex; extern RecursiveMutex cs_main; @@ -699,9 +698,6 @@ public: size_t DynamicMemoryUsage() const; - boost::signals2::signal NotifyEntryAdded; - boost::signals2::signal NotifyEntryRemoved; - private: /** UpdateForDescendants is used by UpdateTransactionsFromBlock to update * the descendants for a single transaction that has been added to the