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