Skip to content

Commit 3ea8b75

Browse files
committed
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.
1 parent cb06edf commit 3ea8b75

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/validationinterface.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,9 @@ void CMainSignals::MempoolEntryRemoved(CTransactionRef ptx, MemPoolRemovalReason
117117
}
118118

119119
void CMainSignals::UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) {
120-
m_internals->UpdatedBlockTip(pindexNew, pindexFork, fInitialDownload);
120+
m_internals->m_schedulerClient.AddToProcessQueue([pindexNew, pindexFork, fInitialDownload, this] {
121+
m_internals->UpdatedBlockTip(pindexNew, pindexFork, fInitialDownload);
122+
});
121123
}
122124

123125
void CMainSignals::TransactionAddedToMempool(const CTransactionRef &ptx) {

src/validationinterface.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@ void CallFunctionInValidationInterfaceQueue(std::function<void ()> func);
4545

4646
class CValidationInterface {
4747
protected:
48-
/** Notifies listeners of updated block chain tip */
48+
/**
49+
* Notifies listeners of updated block chain tip
50+
*
51+
* Called on a background thread.
52+
*/
4953
virtual void UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) {}
5054
/**
5155
* Notifies listeners of a transaction having been added to mempool.

0 commit comments

Comments
 (0)