aboutsummaryrefslogtreecommitdiff
path: root/src/validationinterface.cpp
diff options
context:
space:
mode:
authorJesse Cohen <jc@jc.lol>2018-04-15 11:22:28 -0400
committerJesse Cohen <jc@jc.lol>2018-04-16 18:03:21 -0400
commitd86edd3d3093be4c00d2c6a6fde6dfa77e2f4855 (patch)
tree1995aca8cc1bd01dafc172f8f738475a39f402bd /src/validationinterface.cpp
parent5f2a39946fd42535038e0143cbd289d3070b9f07 (diff)
downloadbitcoin-d86edd3d3093be4c00d2c6a6fde6dfa77e2f4855.tar.xz
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
Diffstat (limited to 'src/validationinterface.cpp')
-rw-r--r--src/validationinterface.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/validationinterface.cpp b/src/validationinterface.cpp
index 928df4fa65..746263f113 100644
--- a/src/validationinterface.cpp
+++ b/src/validationinterface.cpp
@@ -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);
});