diff options
author | Matt Corallo <git@bluematt.me> | 2017-09-30 23:49:59 -0400 |
---|---|---|
committer | Matt Corallo <git@bluematt.me> | 2017-10-13 19:30:15 -0400 |
commit | 3ea8b75281edc60078423bd5d277cd2a84aa5d33 (patch) | |
tree | 0db0d4510f04c1bbf1fd4f8a8199415ec67459e9 | |
parent | cb06edf938302166030db19017c27889ea5b10b6 (diff) |
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.
-rw-r--r-- | src/validationinterface.cpp | 4 | ||||
-rw-r--r-- | src/validationinterface.h | 6 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/validationinterface.cpp b/src/validationinterface.cpp index c6a021119e..d91707cf9f 100644 --- a/src/validationinterface.cpp +++ b/src/validationinterface.cpp @@ -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) { diff --git a/src/validationinterface.h b/src/validationinterface.h index 9b5ac2ac23..1494c6dc21 100644 --- a/src/validationinterface.h +++ b/src/validationinterface.h @@ -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. |