Skip to content

Commit

Permalink
Give ZMQ consistent order with UpdatedBlockTip on scheduler thread
Browse files Browse the repository at this point in the history
Note that UpdatedBlockTip is also used in net_processing to
announce new blocks to peers. As this may need additional review,
this change is included in its own commit.
  • Loading branch information
TheBlueMatt committed Oct 13, 2017
1 parent cb06edf commit 3ea8b75
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/validationinterface.cpp
Expand Up @@ -117,7 +117,9 @@ void CMainSignals::MempoolEntryRemoved(CTransactionRef ptx, MemPoolRemovalReason
}

void CMainSignals::UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) {
m_internals->UpdatedBlockTip(pindexNew, pindexFork, fInitialDownload);
m_internals->m_schedulerClient.AddToProcessQueue([pindexNew, pindexFork, fInitialDownload, this] {
m_internals->UpdatedBlockTip(pindexNew, pindexFork, fInitialDownload);
});
}

void CMainSignals::TransactionAddedToMempool(const CTransactionRef &ptx) {
Expand Down
6 changes: 5 additions & 1 deletion src/validationinterface.h
Expand Up @@ -45,7 +45,11 @@ void CallFunctionInValidationInterfaceQueue(std::function<void ()> func);

class CValidationInterface {
protected:
/** Notifies listeners of updated block chain tip */
/**
* Notifies listeners of updated block chain tip
*
* Called on a background thread.
*/
virtual void UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) {}
/**
* Notifies listeners of a transaction having been added to mempool.
Expand Down

0 comments on commit 3ea8b75

Please sign in to comment.