@@ -2606,40 +2606,43 @@ bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams,
2606
2606
// When we reach this point, we switched to a new tip (stored in pindexNewTip).
2607
2607
2608
2608
// Notifications/callbacks that can run without cs_main
2609
- if (!fInitialDownload ) {
2610
- // Find the hashes of all blocks that weren't previously in the best chain.
2611
- std::vector<uint256> vHashes;
2612
- CBlockIndex *pindexToAnnounce = pindexNewTip;
2613
- while (pindexToAnnounce != pindexFork) {
2614
- vHashes.push_back (pindexToAnnounce->GetBlockHash ());
2615
- pindexToAnnounce = pindexToAnnounce->pprev ;
2616
- if (vHashes.size () == MAX_BLOCKS_TO_ANNOUNCE) {
2617
- // Limit announcements in case of a huge reorganization.
2618
- // Rely on the peer's synchronization mechanism in that case.
2619
- break ;
2609
+ // Always notify the UI if a new block tip was connected
2610
+ if (pindexFork != pindexNewTip) {
2611
+ uiInterface.NotifyBlockTip (fInitialDownload , pindexNewTip);
2612
+
2613
+ if (!fInitialDownload ) {
2614
+ // Find the hashes of all blocks that weren't previously in the best chain.
2615
+ std::vector<uint256> vHashes;
2616
+ CBlockIndex *pindexToAnnounce = pindexNewTip;
2617
+ while (pindexToAnnounce != pindexFork) {
2618
+ vHashes.push_back (pindexToAnnounce->GetBlockHash ());
2619
+ pindexToAnnounce = pindexToAnnounce->pprev ;
2620
+ if (vHashes.size () == MAX_BLOCKS_TO_ANNOUNCE) {
2621
+ // Limit announcements in case of a huge reorganization.
2622
+ // Rely on the peer's synchronization mechanism in that case.
2623
+ break ;
2624
+ }
2620
2625
}
2621
- }
2622
- // Relay inventory, but don't relay old inventory during initial block download.
2623
- int nBlockEstimate = 0 ;
2624
- if ( fCheckpointsEnabled )
2625
- nBlockEstimate = Checkpoints::GetTotalBlocksEstimate (chainparams. Checkpoints ());
2626
- {
2627
- LOCK (cs_vNodes);
2628
- BOOST_FOREACH (CNode* pnode, vNodes ) {
2629
- if (chainActive. Height () > (pnode-> nStartingHeight != - 1 ? pnode-> nStartingHeight - 2000 : nBlockEstimate) ) {
2630
- BOOST_REVERSE_FOREACH ( const uint256& hash, vHashes) {
2631
- pnode-> PushBlockHash (hash);
2626
+ // Relay inventory, but don't relay old inventory during initial block download.
2627
+ int nBlockEstimate = 0 ;
2628
+ if ( fCheckpointsEnabled )
2629
+ nBlockEstimate = Checkpoints::GetTotalBlocksEstimate (chainparams. Checkpoints ());
2630
+ {
2631
+ LOCK (cs_vNodes);
2632
+ BOOST_FOREACH (CNode* pnode, vNodes) {
2633
+ if (chainActive. Height () > ( pnode-> nStartingHeight != - 1 ? pnode-> nStartingHeight - 2000 : nBlockEstimate) ) {
2634
+ BOOST_REVERSE_FOREACH ( const uint256& hash, vHashes ) {
2635
+ pnode-> PushBlockHash (hash);
2636
+ }
2632
2637
}
2633
2638
}
2634
2639
}
2635
- }
2636
- // Notify external listeners about the new tip.
2637
- if (!vHashes. empty ()) {
2638
- GetMainSignals (). UpdatedBlockTip (pindexNewTip);
2640
+ // Notify external listeners about the new tip.
2641
+ if (!vHashes. empty ()) {
2642
+ GetMainSignals (). UpdatedBlockTip (pindexNewTip);
2643
+ }
2639
2644
}
2640
2645
}
2641
- // Always notify the UI if a new block tip was connected
2642
- uiInterface.NotifyBlockTip (fInitialDownload , pindexNewTip);
2643
2646
} while (pindexMostWork != chainActive.Tip ());
2644
2647
CheckBlockIndex (chainparams.GetConsensus ());
2645
2648
0 commit comments