@@ -3028,7 +3028,6 @@ bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams,
3028
3028
const CBlockIndex *pindexFork;
3029
3029
std::list<CTransaction> txConflicted;
3030
3030
bool fInitialDownload ;
3031
- int nNewHeight;
3032
3031
{
3033
3032
LOCK (cs_main);
3034
3033
CBlockIndex *pindexOldTip = chainActive.Tip ();
@@ -3051,13 +3050,10 @@ bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams,
3051
3050
pindexNewTip = chainActive.Tip ();
3052
3051
pindexFork = chainActive.FindFork (pindexOldTip);
3053
3052
fInitialDownload = IsInitialBlockDownload ();
3054
- nNewHeight = chainActive.Height ();
3055
3053
}
3056
3054
// When we reach this point, we switched to a new tip (stored in pindexNewTip).
3057
3055
3058
3056
// Notifications/callbacks that can run without cs_main
3059
- if (connman)
3060
- connman->SetBestHeight (nNewHeight);
3061
3057
3062
3058
// throw all transactions though the signal-interface
3063
3059
// while _not_ holding the cs_main lock
@@ -3069,12 +3065,12 @@ bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams,
3069
3065
for (unsigned int i = 0 ; i < txChanged.size (); i++)
3070
3066
SyncWithWallets (std::get<0 >(txChanged[i]), std::get<1 >(txChanged[i]), std::get<2 >(txChanged[i]));
3071
3067
3068
+ // Notify external listeners about the new tip.
3069
+ GetMainSignals ().UpdatedBlockTip (pindexNewTip, pindexFork, fInitialDownload );
3070
+
3072
3071
// Always notify the UI if a new block tip was connected
3073
3072
if (pindexFork != pindexNewTip) {
3074
3073
uiInterface.NotifyBlockTip (fInitialDownload , pindexNewTip);
3075
-
3076
- // Notify external listeners about the new tip.
3077
- GetMainSignals ().UpdatedBlockTip (pindexNewTip, pindexFork, fInitialDownload );
3078
3074
}
3079
3075
} while (pindexNewTip != pindexMostWork);
3080
3076
CheckBlockIndex (chainparams.GetConsensus ());
@@ -4665,6 +4661,7 @@ std::string GetWarnings(const std::string& strFor)
4665
4661
4666
4662
void PeerLogicValidation::UpdatedBlockTip (const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload ) {
4667
4663
const int nNewHeight = pindexNew->nHeight ;
4664
+ connman->SetBestHeight (nNewHeight);
4668
4665
4669
4666
if (!fInitialDownload ) {
4670
4667
// Find the hashes of all blocks that weren't previously in the best chain.
0 commit comments