@@ -353,7 +353,7 @@ bool CheckSequenceLocks(const CTransaction &tx, int flags, LockPoints* lp, bool
353
353
354
354
CBlockIndex* tip = chainActive.Tip ();
355
355
assert (tip != nullptr );
356
-
356
+
357
357
CBlockIndex index;
358
358
index.pprev = tip;
359
359
// CheckSequenceLocks() uses chainActive.Height()+1 to evaluate
@@ -2677,18 +2677,17 @@ bool CChainState::ActivateBestChain(CValidationState &state, const CChainParams&
2677
2677
assert (trace.pblock && trace.pindex );
2678
2678
GetMainSignals ().BlockConnected (trace.pblock , trace.pindex , trace.conflictedTxs );
2679
2679
}
2680
- }
2681
- // When we reach this point, we switched to a new tip (stored in pindexNewTip).
2682
2680
2683
- // Notifications/callbacks that can run without cs_main
2681
+ // Notify external listeners about the new tip.
2682
+ // Enqueue while holding cs_main to ensure that UpdatedBlockTip is called in the order in which blocks are connected
2683
+ GetMainSignals ().UpdatedBlockTip (pindexNewTip, pindexFork, fInitialDownload );
2684
2684
2685
- // Notify external listeners about the new tip.
2686
- GetMainSignals ().UpdatedBlockTip (pindexNewTip, pindexFork, fInitialDownload );
2687
-
2688
- // Always notify the UI if a new block tip was connected
2689
- if (pindexFork != pindexNewTip) {
2690
- uiInterface.NotifyBlockTip (fInitialDownload , pindexNewTip);
2685
+ // Always notify the UI if a new block tip was connected
2686
+ if (pindexFork != pindexNewTip) {
2687
+ uiInterface.NotifyBlockTip (fInitialDownload , pindexNewTip);
2688
+ }
2691
2689
}
2690
+ // When we reach this point, we switched to a new tip (stored in pindexNewTip).
2692
2691
2693
2692
if (nStopAtHeight && pindexNewTip && pindexNewTip->nHeight >= nStopAtHeight) StartShutdown ();
2694
2693
0 commit comments