Skip to content

Commit e57980b

Browse files
committed
[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.
1 parent 2dd561f commit e57980b

File tree

4 files changed

+4
-8
lines changed

4 files changed

+4
-8
lines changed

src/init.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
#include <boost/algorithm/string/classification.hpp>
7575
#include <boost/algorithm/string/replace.hpp>
7676
#include <boost/algorithm/string/split.hpp>
77+
#include <boost/signals2/signal.hpp>
7778
#include <boost/thread.hpp>
7879

7980
#if ENABLE_ZMQ

src/interfaces/node.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737

3838
#include <univalue.h>
3939

40+
#include <boost/signals2/signal.hpp>
41+
4042
class CWallet;
4143
fs::path GetWalletDir();
4244
std::vector<fs::path> ListWalletDir();

src/txmempool.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,6 @@ void CTxMemPool::AddTransactionsUpdated(unsigned int n)
355355

356356
void CTxMemPool::addUnchecked(const CTxMemPoolEntry &entry, setEntries &setAncestors, bool validFeeEstimate)
357357
{
358-
NotifyEntryAdded(entry.GetSharedTx());
359358
// Add to memory pool without checking anything.
360359
// Used by AcceptToMemoryPool(), which DOES do
361360
// all the appropriate checks.
@@ -406,14 +405,12 @@ void CTxMemPool::addUnchecked(const CTxMemPoolEntry &entry, setEntries &setAnces
406405

407406
void CTxMemPool::removeUnchecked(txiter it, MemPoolRemovalReason reason)
408407
{
409-
CTransactionRef ptx = it->GetSharedTx();
410-
NotifyEntryRemoved(ptx, reason);
411408
if (reason != MemPoolRemovalReason::BLOCK) {
412409
// Notify clients that a transaction has been removed from the mempool
413410
// for any reason except being included in a block. Clients interested
414411
// in transactions included in blocks can subscribe to the BlockConnected
415412
// notification.
416-
GetMainSignals().TransactionRemovedFromMempool(ptx);
413+
GetMainSignals().TransactionRemovedFromMempool(it->GetSharedTx());
417414
}
418415

419416
const uint256 hash = it->GetTx().GetHash();

src/txmempool.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#include <boost/multi_index/hashed_index.hpp>
2828
#include <boost/multi_index/ordered_index.hpp>
2929
#include <boost/multi_index/sequenced_index.hpp>
30-
#include <boost/signals2/signal.hpp>
3130

3231
class CBlockIndex;
3332
extern RecursiveMutex cs_main;
@@ -699,9 +698,6 @@ class CTxMemPool
699698

700699
size_t DynamicMemoryUsage() const;
701700

702-
boost::signals2::signal<void (CTransactionRef)> NotifyEntryAdded;
703-
boost::signals2::signal<void (CTransactionRef, MemPoolRemovalReason)> NotifyEntryRemoved;
704-
705701
private:
706702
/** UpdateForDescendants is used by UpdateTransactionsFromBlock to update
707703
* the descendants for a single transaction that has been added to the

0 commit comments

Comments
 (0)