Give ZMQ consistent order with UpdatedBlockTip on scheduler thread

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.
This commit is contained in:
Matt Corallo 2017-09-30 23:49:59 -04:00
parent cb06edf938
commit 3ea8b75281
2 changed files with 8 additions and 2 deletions

View file

@ -117,7 +117,9 @@ void CMainSignals::MempoolEntryRemoved(CTransactionRef ptx, MemPoolRemovalReason
} }
void CMainSignals::UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) { void CMainSignals::UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) {
m_internals->m_schedulerClient.AddToProcessQueue([pindexNew, pindexFork, fInitialDownload, this] {
m_internals->UpdatedBlockTip(pindexNew, pindexFork, fInitialDownload); m_internals->UpdatedBlockTip(pindexNew, pindexFork, fInitialDownload);
});
} }
void CMainSignals::TransactionAddedToMempool(const CTransactionRef &ptx) { void CMainSignals::TransactionAddedToMempool(const CTransactionRef &ptx) {

View file

@ -45,7 +45,11 @@ void CallFunctionInValidationInterfaceQueue(std::function<void ()> func);
class CValidationInterface { class CValidationInterface {
protected: 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) {} virtual void UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) {}
/** /**
* Notifies listeners of a transaction having been added to mempool. * Notifies listeners of a transaction having been added to mempool.