@@ -3028,7 +3028,6 @@ bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams,
30283028 const CBlockIndex *pindexFork;
30293029 std::list<CTransaction> txConflicted;
30303030 bool fInitialDownload ;
3031- int nNewHeight;
30323031 {
30333032 LOCK (cs_main);
30343033 CBlockIndex *pindexOldTip = chainActive.Tip ();
@@ -3051,13 +3050,10 @@ bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams,
30513050 pindexNewTip = chainActive.Tip ();
30523051 pindexFork = chainActive.FindFork (pindexOldTip);
30533052 fInitialDownload = IsInitialBlockDownload ();
3054- nNewHeight = chainActive.Height ();
30553053 }
30563054 // When we reach this point, we switched to a new tip (stored in pindexNewTip).
30573055
30583056 // Notifications/callbacks that can run without cs_main
3059- if (connman)
3060- connman->SetBestHeight (nNewHeight);
30613057
30623058 // throw all transactions though the signal-interface
30633059 // while _not_ holding the cs_main lock
@@ -3069,12 +3065,12 @@ bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams,
30693065 for (unsigned int i = 0 ; i < txChanged.size (); i++)
30703066 SyncWithWallets (std::get<0 >(txChanged[i]), std::get<1 >(txChanged[i]), std::get<2 >(txChanged[i]));
30713067
3068+ // Notify external listeners about the new tip.
3069+ GetMainSignals ().UpdatedBlockTip (pindexNewTip, pindexFork, fInitialDownload );
3070+
30723071 // Always notify the UI if a new block tip was connected
30733072 if (pindexFork != pindexNewTip) {
30743073 uiInterface.NotifyBlockTip (fInitialDownload , pindexNewTip);
3075-
3076- // Notify external listeners about the new tip.
3077- GetMainSignals ().UpdatedBlockTip (pindexNewTip, pindexFork, fInitialDownload );
30783074 }
30793075 } while (pindexNewTip != pindexMostWork);
30803076 CheckBlockIndex (chainparams.GetConsensus ());
@@ -4665,6 +4661,7 @@ std::string GetWarnings(const std::string& strFor)
46654661
46664662void PeerLogicValidation::UpdatedBlockTip (const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload ) {
46674663 const int nNewHeight = pindexNew->nHeight ;
4664+ connman->SetBestHeight (nNewHeight);
46684665
46694666 if (!fInitialDownload ) {
46704667 // Find the hashes of all blocks that weren't previously in the best chain.
0 commit comments