From 1b396b87c7dca0cd9456450478a4125fe8d6d9f9 Mon Sep 17 00:00:00 2001 From: furszy Date: Tue, 19 Jan 2021 19:50:41 -0300 Subject: [PATCH] Move `NotifyEntryRemoved` to use the general interfaces::MakeHandler --- src/validation.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/validation.cpp b/src/validation.cpp index fdcf92b447500..53ad53488661a 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -26,8 +26,8 @@ #include "guiinterface.h" #include "init.h" #include "invalid.h" +#include "interfaces/handler.h" #include "legacy/validation_zerocoin_legacy.h" -#include "libzerocoin/Denominations.h" #include "kernel.h" #include "masternode-payments.h" #include "masternode-sync.h" @@ -186,10 +186,11 @@ class MemPoolConflictRemovalTracker private: std::vector conflictedTxs; CTxMemPool &pool; + std::unique_ptr m_handler_notify_entry_removed; public: MemPoolConflictRemovalTracker(CTxMemPool &_pool) : pool(_pool) { - pool.NotifyEntryRemoved.connect(std::bind(&MemPoolConflictRemovalTracker::NotifyEntryRemoved, this, std::placeholders::_1, std::placeholders::_2)); + m_handler_notify_entry_removed = interfaces::MakeHandler(pool.NotifyEntryRemoved.connect(std::bind(&MemPoolConflictRemovalTracker::NotifyEntryRemoved, this, std::placeholders::_1, std::placeholders::_2))); } void NotifyEntryRemoved(CTransactionRef txRemoved, MemPoolRemovalReason reason) { @@ -199,7 +200,7 @@ class MemPoolConflictRemovalTracker } ~MemPoolConflictRemovalTracker() { - pool.NotifyEntryRemoved.disconnect(std::bind(&MemPoolConflictRemovalTracker::NotifyEntryRemoved, this, std::placeholders::_1, std::placeholders::_2)); + m_handler_notify_entry_removed->disconnect(); for (const auto& tx : conflictedTxs) { GetMainSignals().SyncTransaction(*tx, nullptr, CMainSignals::SYNC_TRANSACTION_NOT_IN_BLOCK); }