From 1168394d759b13af68acec6d5bfa04aaa24561f8 Mon Sep 17 00:00:00 2001 From: John Newbery Date: Mon, 11 Nov 2019 10:34:31 -0500 Subject: [PATCH 1/6] [wallet] Notify conflicted transactions in TransactionRemovedFromMempool The only CValidationInterface client that cares about transactions that are removed from the mempool because of CONFLICT is the wallet. Start using the TransactionRemovedFromMempool method to notify about conflicted transactions instead of using the vtxConflicted vector in BlockConnected. --- src/txmempool.cpp | 6 +++++- src/validationinterface.h | 30 ++++++++++++++++++++++++++---- src/wallet/wallet.cpp | 3 --- 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/src/txmempool.cpp b/src/txmempool.cpp index 5768219f3a5..f04f13e6e00 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -408,7 +408,11 @@ void CTxMemPool::removeUnchecked(txiter it, MemPoolRemovalReason reason) { CTransactionRef ptx = it->GetSharedTx(); NotifyEntryRemoved(ptx, reason); - if (reason != MemPoolRemovalReason::BLOCK && reason != MemPoolRemovalReason::CONFLICT) { + 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); } diff --git a/src/validationinterface.h b/src/validationinterface.h index ed6c560944a..3bb4639f470 100644 --- a/src/validationinterface.h +++ b/src/validationinterface.h @@ -92,10 +92,32 @@ protected: /** * Notifies listeners of a transaction leaving mempool. * - * This only fires for transactions which leave mempool because of expiry, - * size limiting, reorg (changes in lock times/coinbase maturity), or - * replacement. This does not include any transactions which are included - * in BlockConnectedDisconnected either in block->vtx or in txnConflicted. + * This notification fires for transactions that are removed from the + * mempool for the following reasons: + * + * - EXPIRY (expired from mempool after -mempoolexpiry hours) + * - SIZELIMIT (removed in size limiting if the mempool exceeds -maxmempool megabytes) + * - REORG (removed during a reorg) + * - CONFLICT (removed because it conflicts with in-block transaction) + * - REPLACED (removed due to RBF replacement) + * + * This does not fire for transactions that are removed from the mempool + * because they have been included in a block. Any client that is interested + * in transactions removed from the mempool for inclusion in a block can learn + * about those transactions from the BlockConnected notification. + * + * Transactions that are removed from the mempool because they conflict + * with a transaction in the new block will have + * TransactionRemovedFromMempool events fired *before* the BlockConnected + * event is fired. If multiple blocks are connected in one step, then the + * ordering could be: + * + * - TransactionRemovedFromMempool(tx1 from block A) + * - TransactionRemovedFromMempool(tx2 from block A) + * - TransactionRemovedFromMempool(tx1 from block B) + * - TransactionRemovedFromMempool(tx2 from block B) + * - BlockConnected(A) + * - BlockConnected(B) * * Called on a background thread. */ diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 02fe59b601d..8c63f5b9070 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1123,9 +1123,6 @@ void CWallet::BlockConnected(const CBlock& block, const std::vector Date: Mon, 11 Nov 2019 10:43:34 -0500 Subject: [PATCH 2/6] [validation interface] Remove vtxConflicted from BlockConnected The wallet now uses TransactionRemovedFromMempool to be notified about conflicted wallet, and no other clients use vtxConflicted. --- src/index/base.cpp | 3 +-- src/index/base.h | 3 +-- src/interfaces/chain.cpp | 6 ++---- src/interfaces/chain.h | 2 +- src/net_processing.cpp | 2 +- src/net_processing.h | 2 +- src/test/validation_block_tests.cpp | 2 +- src/validation.cpp | 2 +- src/validationinterface.cpp | 10 +++++----- src/validationinterface.h | 4 ++-- src/wallet/wallet.cpp | 2 +- src/wallet/wallet.h | 2 +- src/zmq/zmqnotificationinterface.cpp | 2 +- src/zmq/zmqnotificationinterface.h | 2 +- 14 files changed, 20 insertions(+), 24 deletions(-) diff --git a/src/index/base.cpp b/src/index/base.cpp index dcb8e99fc13..7ee4bf22b0b 100644 --- a/src/index/base.cpp +++ b/src/index/base.cpp @@ -188,8 +188,7 @@ bool BaseIndex::Rewind(const CBlockIndex* current_tip, const CBlockIndex* new_ti return true; } -void BaseIndex::BlockConnected(const std::shared_ptr& block, const CBlockIndex* pindex, - const std::vector& txn_conflicted) +void BaseIndex::BlockConnected(const std::shared_ptr& block, const CBlockIndex* pindex) { if (!m_synced) { return; diff --git a/src/index/base.h b/src/index/base.h index d0088d9c9a5..4e86e1f600d 100644 --- a/src/index/base.h +++ b/src/index/base.h @@ -64,8 +64,7 @@ private: bool Commit(); protected: - void BlockConnected(const std::shared_ptr& block, const CBlockIndex* pindex, - const std::vector& txn_conflicted) override; + void BlockConnected(const std::shared_ptr& block, const CBlockIndex* pindex) override; void ChainStateFlushed(const CBlockLocator& locator) override; diff --git a/src/interfaces/chain.cpp b/src/interfaces/chain.cpp index 643bb58d56c..d16f4e7ccce 100644 --- a/src/interfaces/chain.cpp +++ b/src/interfaces/chain.cpp @@ -172,11 +172,9 @@ public: { m_notifications->TransactionRemovedFromMempool(tx); } - void BlockConnected(const std::shared_ptr& block, - const CBlockIndex* index, - const std::vector& tx_conflicted) override + void BlockConnected(const std::shared_ptr& block, const CBlockIndex* index) override { - m_notifications->BlockConnected(*block, tx_conflicted, index->nHeight); + m_notifications->BlockConnected(*block, index->nHeight); } void BlockDisconnected(const std::shared_ptr& block, const CBlockIndex* index) override { diff --git a/src/interfaces/chain.h b/src/interfaces/chain.h index 7304f82749b..03a600d5a3b 100644 --- a/src/interfaces/chain.h +++ b/src/interfaces/chain.h @@ -219,7 +219,7 @@ public: virtual ~Notifications() {} virtual void TransactionAddedToMempool(const CTransactionRef& tx) {} virtual void TransactionRemovedFromMempool(const CTransactionRef& ptx) {} - virtual void BlockConnected(const CBlock& block, const std::vector& tx_conflicted, int height) {} + virtual void BlockConnected(const CBlock& block, int height) {} virtual void BlockDisconnected(const CBlock& block, int height) {} virtual void UpdatedBlockTip() {} virtual void ChainStateFlushed(const CBlockLocator& locator) {} diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 1c1046b6ff8..80361b381d9 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -1132,7 +1132,7 @@ PeerLogicValidation::PeerLogicValidation(CConnman* connmanIn, BanMan* banman, CS * Evict orphan txn pool entries (EraseOrphanTx) based on a newly connected * block. Also save the time of the last tip update. */ -void PeerLogicValidation::BlockConnected(const std::shared_ptr& pblock, const CBlockIndex* pindex, const std::vector& vtxConflicted) +void PeerLogicValidation::BlockConnected(const std::shared_ptr& pblock, const CBlockIndex* pindex) { { LOCK(g_cs_orphans); diff --git a/src/net_processing.h b/src/net_processing.h index 6f26abc209e..908d645f009 100644 --- a/src/net_processing.h +++ b/src/net_processing.h @@ -32,7 +32,7 @@ public: /** * Overridden from CValidationInterface. */ - void BlockConnected(const std::shared_ptr& pblock, const CBlockIndex* pindexConnected, const std::vector& vtxConflicted) override; + void BlockConnected(const std::shared_ptr& pblock, const CBlockIndex* pindexConnected) override; void BlockDisconnected(const std::shared_ptr &block, const CBlockIndex* pindex) override; /** * Overridden from CValidationInterface. diff --git a/src/test/validation_block_tests.cpp b/src/test/validation_block_tests.cpp index dae389a167f..4c72ed1fc0b 100644 --- a/src/test/validation_block_tests.cpp +++ b/src/test/validation_block_tests.cpp @@ -42,7 +42,7 @@ struct TestSubscriber : public CValidationInterface { BOOST_CHECK_EQUAL(m_expected_tip, pindexNew->GetBlockHash()); } - void BlockConnected(const std::shared_ptr& block, const CBlockIndex* pindex, const std::vector& txnConflicted) override + void BlockConnected(const std::shared_ptr& block, const CBlockIndex* pindex) override { BOOST_CHECK_EQUAL(m_expected_tip, block->hashPrevBlock); BOOST_CHECK_EQUAL(m_expected_tip, pindex->pprev->GetBlockHash()); diff --git a/src/validation.cpp b/src/validation.cpp index bab04b8e343..3f6f358092c 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -2881,7 +2881,7 @@ bool CChainState::ActivateBestChain(BlockValidationState &state, const CChainPar for (const PerBlockConnectTrace& trace : connectTrace.GetBlocksConnected()) { assert(trace.pblock && trace.pindex); - GetMainSignals().BlockConnected(trace.pblock, trace.pindex, trace.conflictedTxs); + GetMainSignals().BlockConnected(trace.pblock, trace.pindex); } } while (!m_chain.Tip() || (starting_tip && CBlockIndexWorkComparator()(m_chain.Tip(), starting_tip))); if (!blocks_connected) return true; diff --git a/src/validationinterface.cpp b/src/validationinterface.cpp index 0f513c065f9..2e52de09b4e 100644 --- a/src/validationinterface.cpp +++ b/src/validationinterface.cpp @@ -33,7 +33,7 @@ struct ValidationInterfaceConnections { struct MainSignalsInstance { boost::signals2::signal UpdatedBlockTip; boost::signals2::signal TransactionAddedToMempool; - boost::signals2::signal &, const CBlockIndex *pindex, const std::vector&)> BlockConnected; + boost::signals2::signal &, const CBlockIndex *pindex)> BlockConnected; boost::signals2::signal&, const CBlockIndex* pindex)> BlockDisconnected; boost::signals2::signal TransactionRemovedFromMempool; boost::signals2::signal ChainStateFlushed; @@ -80,7 +80,7 @@ void RegisterValidationInterface(CValidationInterface* pwalletIn) { ValidationInterfaceConnections& conns = g_signals.m_internals->m_connMainSignals[pwalletIn]; conns.UpdatedBlockTip = g_signals.m_internals->UpdatedBlockTip.connect(std::bind(&CValidationInterface::UpdatedBlockTip, pwalletIn, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); conns.TransactionAddedToMempool = g_signals.m_internals->TransactionAddedToMempool.connect(std::bind(&CValidationInterface::TransactionAddedToMempool, pwalletIn, std::placeholders::_1)); - conns.BlockConnected = g_signals.m_internals->BlockConnected.connect(std::bind(&CValidationInterface::BlockConnected, pwalletIn, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); + conns.BlockConnected = g_signals.m_internals->BlockConnected.connect(std::bind(&CValidationInterface::BlockConnected, pwalletIn, std::placeholders::_1, std::placeholders::_2)); conns.BlockDisconnected = g_signals.m_internals->BlockDisconnected.connect(std::bind(&CValidationInterface::BlockDisconnected, pwalletIn, std::placeholders::_1, std::placeholders::_2)); conns.TransactionRemovedFromMempool = g_signals.m_internals->TransactionRemovedFromMempool.connect(std::bind(&CValidationInterface::TransactionRemovedFromMempool, pwalletIn, std::placeholders::_1)); conns.ChainStateFlushed = g_signals.m_internals->ChainStateFlushed.connect(std::bind(&CValidationInterface::ChainStateFlushed, pwalletIn, std::placeholders::_1)); @@ -164,9 +164,9 @@ void CMainSignals::TransactionRemovedFromMempool(const CTransactionRef &ptx) { ptx->GetWitnessHash().ToString()); } -void CMainSignals::BlockConnected(const std::shared_ptr &pblock, const CBlockIndex *pindex, const std::shared_ptr>& pvtxConflicted) { - auto event = [pblock, pindex, pvtxConflicted, this] { - m_internals->BlockConnected(pblock, pindex, *pvtxConflicted); +void CMainSignals::BlockConnected(const std::shared_ptr &pblock, const CBlockIndex *pindex) { + auto event = [pblock, pindex, this] { + m_internals->BlockConnected(pblock, pindex); }; ENQUEUE_AND_LOG_EVENT(event, "%s: block hash=%s block height=%d", __func__, pblock->GetHash().ToString(), diff --git a/src/validationinterface.h b/src/validationinterface.h index 3bb4639f470..57074226354 100644 --- a/src/validationinterface.h +++ b/src/validationinterface.h @@ -128,7 +128,7 @@ protected: * * Called on a background thread. */ - virtual void BlockConnected(const std::shared_ptr &block, const CBlockIndex *pindex, const std::vector &txnConflicted) {} + virtual void BlockConnected(const std::shared_ptr &block, const CBlockIndex *pindex) {} /** * Notifies listeners of a block being disconnected * @@ -192,7 +192,7 @@ public: void UpdatedBlockTip(const CBlockIndex *, const CBlockIndex *, bool fInitialDownload); void TransactionAddedToMempool(const CTransactionRef &); void TransactionRemovedFromMempool(const CTransactionRef &); - void BlockConnected(const std::shared_ptr &, const CBlockIndex *pindex, const std::shared_ptr> &); + void BlockConnected(const std::shared_ptr &, const CBlockIndex *pindex); void BlockDisconnected(const std::shared_ptr &, const CBlockIndex* pindex); void ChainStateFlushed(const CBlockLocator &); void BlockChecked(const CBlock&, const BlockValidationState&); diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 8c63f5b9070..4b705f4e777 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1110,7 +1110,7 @@ void CWallet::TransactionRemovedFromMempool(const CTransactionRef &ptx) { } } -void CWallet::BlockConnected(const CBlock& block, const std::vector& vtxConflicted, int height) +void CWallet::BlockConnected(const CBlock& block, int height) { const uint256& block_hash = block.GetHash(); auto locked_chain = chain().lock(); diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 6c1c3040c24..34c3cd38183 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -874,7 +874,7 @@ public: bool AddToWallet(const CWalletTx& wtxIn, bool fFlushOnClose=true); void LoadToWallet(CWalletTx& wtxIn) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); void TransactionAddedToMempool(const CTransactionRef& tx) override; - void BlockConnected(const CBlock& block, const std::vector& vtxConflicted, int height) override; + void BlockConnected(const CBlock& block, int height) override; void BlockDisconnected(const CBlock& block, int height) override; void UpdatedBlockTip() override; int64_t RescanFromTime(int64_t startTime, const WalletRescanReserver& reserver, bool update); diff --git a/src/zmq/zmqnotificationinterface.cpp b/src/zmq/zmqnotificationinterface.cpp index 0ce14f232ed..d55b106e04d 100644 --- a/src/zmq/zmqnotificationinterface.cpp +++ b/src/zmq/zmqnotificationinterface.cpp @@ -177,7 +177,7 @@ void CZMQNotificationInterface::TransactionAddedToMempool(const CTransactionRef& } } -void CZMQNotificationInterface::BlockConnected(const std::shared_ptr& pblock, const CBlockIndex* pindexConnected, const std::vector& vtxConflicted) +void CZMQNotificationInterface::BlockConnected(const std::shared_ptr& pblock, const CBlockIndex* pindexConnected) { for (const CTransactionRef& ptx : pblock->vtx) { // Do a normal notify for each transaction added in the block diff --git a/src/zmq/zmqnotificationinterface.h b/src/zmq/zmqnotificationinterface.h index c8208654979..60f3b6148a7 100644 --- a/src/zmq/zmqnotificationinterface.h +++ b/src/zmq/zmqnotificationinterface.h @@ -26,7 +26,7 @@ protected: // CValidationInterface void TransactionAddedToMempool(const CTransactionRef& tx) override; - void BlockConnected(const std::shared_ptr& pblock, const CBlockIndex* pindexConnected, const std::vector& vtxConflicted) override; + void BlockConnected(const std::shared_ptr& pblock, const CBlockIndex* pindexConnected) override; void BlockDisconnected(const std::shared_ptr& pblock, const CBlockIndex* pindexDisconnected) override; void UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) override; From 5613f9842b4000fed088b8cf7b99674c328d15e1 Mon Sep 17 00:00:00 2001 From: John Newbery Date: Mon, 11 Nov 2019 10:46:09 -0500 Subject: [PATCH 3/6] [validation] Remove conflictedTxs from PerBlockConnectTrace Since we don't add a vtxConflicted vector to BlockConnected the conflictedTxs member of PerBlockConnectTrace is no longer used. --- src/validation.cpp | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/src/validation.cpp b/src/validation.cpp index 3f6f358092c..c5318293bc5 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -2505,22 +2505,12 @@ static int64_t nTimePostConnect = 0; struct PerBlockConnectTrace { CBlockIndex* pindex = nullptr; std::shared_ptr pblock; - std::shared_ptr> conflictedTxs; - PerBlockConnectTrace() : conflictedTxs(std::make_shared>()) {} + PerBlockConnectTrace() {} }; /** * Used to track blocks whose transactions were applied to the UTXO state as a * part of a single ActivateBestChainStep call. * - * This class also tracks transactions that are removed from the mempool as - * conflicts (per block) and can be used to pass all those transactions - * through SyncTransaction. - * - * This class assumes (and asserts) that the conflicted transactions for a given - * block are added via mempool callbacks prior to the BlockConnected() associated - * with those transactions. If any transactions are marked conflicted, it is - * assumed that an associated block will always be added. - * * This class is single-use, once you call GetBlocksConnected() you have to throw * it away and make a new one. */ @@ -2551,16 +2541,12 @@ public: // one waiting for the transactions from the next block. We pop // the last entry here to make sure the list we return is sane. assert(!blocksConnected.back().pindex); - assert(blocksConnected.back().conflictedTxs->empty()); blocksConnected.pop_back(); return blocksConnected; } void NotifyEntryRemoved(CTransactionRef txRemoved, MemPoolRemovalReason reason) { assert(!blocksConnected.back().pindex); - if (reason == MemPoolRemovalReason::CONFLICT) { - blocksConnected.back().conflictedTxs->emplace_back(std::move(txRemoved)); - } } }; From 969b65f3f527631ede1a31c7855151e5c5d91f8f Mon Sep 17 00:00:00 2001 From: John Newbery Date: Mon, 11 Nov 2019 10:50:21 -0500 Subject: [PATCH 4/6] [validation] Remove NotifyEntryRemoved callback from ConnectTrace ConnectTrace used to subscribe to the mempool's NotifyEntryRemoved callback to be notified of transactions removed for conflict. Since PerBlockConnectTrace no longer tracks conflicted transactions, ConnectTrace no longer requires these notifications. --- src/validation.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/validation.cpp b/src/validation.cpp index c5318293bc5..1f1585041ab 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -2518,12 +2518,9 @@ class ConnectTrace { private: std::vector blocksConnected; CTxMemPool &pool; - boost::signals2::scoped_connection m_connNotifyEntryRemoved; public: - explicit ConnectTrace(CTxMemPool &_pool) : blocksConnected(1), pool(_pool) { - m_connNotifyEntryRemoved = pool.NotifyEntryRemoved.connect(std::bind(&ConnectTrace::NotifyEntryRemoved, this, std::placeholders::_1, std::placeholders::_2)); - } + explicit ConnectTrace(CTxMemPool &_pool) : blocksConnected(1), pool(_pool) {} void BlockConnected(CBlockIndex* pindex, std::shared_ptr pblock) { assert(!blocksConnected.back().pindex); @@ -2544,10 +2541,6 @@ public: blocksConnected.pop_back(); return blocksConnected; } - - void NotifyEntryRemoved(CTransactionRef txRemoved, MemPoolRemovalReason reason) { - assert(!blocksConnected.back().pindex); - } }; /** From 2dd561f36124972d2364f941de9c3417c65f05b6 Mon Sep 17 00:00:00 2001 From: John Newbery Date: Fri, 15 Nov 2019 15:33:27 -0500 Subject: [PATCH 5/6] [validation] Remove pool member from ConnectTrace It's no longer used for anything. --- src/validation.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/validation.cpp b/src/validation.cpp index 1f1585041ab..6d6ba80564c 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -2517,10 +2517,9 @@ struct PerBlockConnectTrace { class ConnectTrace { private: std::vector blocksConnected; - CTxMemPool &pool; public: - explicit ConnectTrace(CTxMemPool &_pool) : blocksConnected(1), pool(_pool) {} + explicit ConnectTrace() : blocksConnected(1) {} void BlockConnected(CBlockIndex* pindex, std::shared_ptr pblock) { assert(!blocksConnected.back().pindex); @@ -2833,7 +2832,7 @@ bool CChainState::ActivateBestChain(BlockValidationState &state, const CChainPar do { // We absolutely may not unlock cs_main until we've made forward progress // (with the exception of shutdown due to hardware issues, low disk space, etc). - ConnectTrace connectTrace(mempool); // Destructed before cs_main is unlocked + ConnectTrace connectTrace; // Destructed before cs_main is unlocked if (pindexMostWork == nullptr) { pindexMostWork = FindMostWorkChain(); From e57980b4738c10344baf136de3e050a3cb958ca5 Mon Sep 17 00:00:00 2001 From: John Newbery Date: Mon, 11 Nov 2019 10:53:03 -0500 Subject: [PATCH 6/6] [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