Skip to content

Commit

Permalink
Rename CMainSignals::MempoolEntryRemoved to TransactionRemovedFromMem…
Browse files Browse the repository at this point in the history
…pool

This renaming was suggested in bitcoin#10286. Additionally, it makes logging in
a proceeding commit symmetric with TransactionAddedToMempool when using
__func__.
  • Loading branch information
Jeffrey Czyz committed Aug 22, 2019
1 parent 52b9797 commit 5c3f8e1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions src/validationinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ size_t CMainSignals::CallbacksPending() {
void CMainSignals::RegisterWithMempoolSignals(CTxMemPool& pool) {
g_connNotifyEntryRemoved.emplace(std::piecewise_construct,
std::forward_as_tuple(&pool),
std::forward_as_tuple(pool.NotifyEntryRemoved.connect(std::bind(&CMainSignals::MempoolEntryRemoved, this, std::placeholders::_1, std::placeholders::_2)))
std::forward_as_tuple(pool.NotifyEntryRemoved.connect(std::bind(&CMainSignals::TransactionRemovedFromMempool, this, std::placeholders::_1, std::placeholders::_2)))
);
}

Expand Down Expand Up @@ -128,14 +128,6 @@ void SyncWithValidationInterfaceQueue() {
promise.get_future().wait();
}

void CMainSignals::MempoolEntryRemoved(CTransactionRef ptx, MemPoolRemovalReason reason) {
if (reason != MemPoolRemovalReason::BLOCK && reason != MemPoolRemovalReason::CONFLICT) {
m_internals->m_schedulerClient.AddToProcessQueue([ptx, this] {
m_internals->TransactionRemovedFromMempool(ptx);
});
}
}

void CMainSignals::UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) {
// Dependencies exist that require UpdatedBlockTip events to be delivered in the order in which
// the chain actually updates. One way to ensure this is for the caller to invoke this signal
Expand All @@ -152,6 +144,14 @@ void CMainSignals::TransactionAddedToMempool(const CTransactionRef &ptx) {
});
}

void CMainSignals::TransactionRemovedFromMempool(CTransactionRef ptx, MemPoolRemovalReason reason) {
if (reason != MemPoolRemovalReason::BLOCK && reason != MemPoolRemovalReason::CONFLICT) {
m_internals->m_schedulerClient.AddToProcessQueue([ptx, this] {
m_internals->TransactionRemovedFromMempool(ptx);
});
}
}

void CMainSignals::BlockConnected(const std::shared_ptr<const CBlock> &pblock, const CBlockIndex *pindex, const std::shared_ptr<const std::vector<CTransactionRef>>& pvtxConflicted) {
m_internals->m_schedulerClient.AddToProcessQueue([pblock, pindex, pvtxConflicted, this] {
m_internals->BlockConnected(pblock, pindex, *pvtxConflicted);
Expand Down
2 changes: 1 addition & 1 deletion src/validationinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class CMainSignals {
friend void ::UnregisterAllValidationInterfaces();
friend void ::CallFunctionInValidationInterfaceQueue(std::function<void ()> func);

void MempoolEntryRemoved(CTransactionRef tx, MemPoolRemovalReason reason);
void TransactionRemovedFromMempool(CTransactionRef tx, MemPoolRemovalReason reason);

public:
/** Register a CScheduler to give callbacks which should run in the background (may only be called once) */
Expand Down

0 comments on commit 5c3f8e1

Please sign in to comment.