Hold cs_main while calling UpdatedBlockTip() and ui.NotifyBlockTip

Ensures that callbacks are invoked in the order in which the chain is updated
Resolves #12978
This commit is contained in:
Jesse Cohen
2018-04-15 11:22:28 -04:00
parent 5f2a39946f
commit d86edd3d30
2 changed files with 14 additions and 11 deletions

View File

@@ -139,6 +139,10 @@ void CMainSignals::MempoolEntryRemoved(CTransactionRef ptx, MemPoolRemovalReason
}
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
// in the same critical section where the chain is updated
m_internals->m_schedulerClient.AddToProcessQueue([pindexNew, pindexFork, fInitialDownload, this] {
m_internals->UpdatedBlockTip(pindexNew, pindexFork, fInitialDownload);
});