Skip to content

Commit

Permalink
Move NotifyEntryRemoved to use the general interfaces::MakeHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
furszy committed Jan 28, 2021
1 parent 4cb5820 commit 1b396b8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -186,10 +186,11 @@ class MemPoolConflictRemovalTracker
private:
std::vector<CTransactionRef> conflictedTxs;
CTxMemPool &pool;
std::unique_ptr<interfaces::Handler> 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) {
Expand All @@ -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);
}
Expand Down

0 comments on commit 1b396b8

Please sign in to comment.