@@ -2770,7 +2770,7 @@ static SynchronizationState GetSynchronizationState(bool init)
2770
2770
return SynchronizationState::INIT_DOWNLOAD;
2771
2771
}
2772
2772
2773
- static bool NotifyHeaderTip () LOCKS_EXCLUDED(cs_main) {
2773
+ static bool NotifyHeaderTip (CChainState& chainstate ) LOCKS_EXCLUDED(cs_main) {
2774
2774
bool fNotify = false ;
2775
2775
bool fInitialBlockDownload = false ;
2776
2776
static CBlockIndex* pindexHeaderOld = nullptr ;
@@ -2781,7 +2781,8 @@ static bool NotifyHeaderTip() LOCKS_EXCLUDED(cs_main) {
2781
2781
2782
2782
if (pindexHeader != pindexHeaderOld) {
2783
2783
fNotify = true ;
2784
- fInitialBlockDownload = ::ChainstateActive ().IsInitialBlockDownload ();
2784
+ assert (std::addressof (::ChainstateActive ()) == std::addressof (chainstate));
2785
+ fInitialBlockDownload = chainstate.IsInitialBlockDownload ();
2785
2786
pindexHeaderOld = pindexHeader;
2786
2787
}
2787
2788
}
@@ -3664,7 +3665,7 @@ bool ChainstateManager::ProcessNewBlockHeaders(const std::vector<CBlockHeader>&
3664
3665
}
3665
3666
}
3666
3667
}
3667
- if (NotifyHeaderTip ()) {
3668
+ if (NotifyHeaderTip (:: ChainstateActive () )) {
3668
3669
if (::ChainstateActive ().IsInitialBlockDownload () && ppindex && *ppindex) {
3669
3670
LogPrintf (" Synchronizing blockheaders, height: %d (~%.2f%%)\n " , (*ppindex)->nHeight , 100.0 /((*ppindex)->nHeight +(GetAdjustedTime () - (*ppindex)->GetBlockTime ()) / Params ().GetConsensus ().nPowTargetSpacing ) * (*ppindex)->nHeight );
3670
3671
}
@@ -3800,7 +3801,7 @@ bool ChainstateManager::ProcessNewBlock(const CChainParams& chainparams, const s
3800
3801
}
3801
3802
}
3802
3803
3803
- NotifyHeaderTip ();
3804
+ NotifyHeaderTip (:: ChainstateActive () );
3804
3805
3805
3806
BlockValidationState state; // Only used to report errors, not invalidity - ignore it
3806
3807
if (!::ChainstateActive ().ActivateBestChain (state, chainparams, pblock))
@@ -4685,7 +4686,7 @@ void LoadExternalBlockFile(const CChainParams& chainparams, FILE* fileIn, FlatFi
4685
4686
}
4686
4687
}
4687
4688
4688
- NotifyHeaderTip ();
4689
+ NotifyHeaderTip (:: ChainstateActive () );
4689
4690
4690
4691
// Recursively process earlier encountered successors of this block
4691
4692
std::deque<uint256> queue;
@@ -4711,7 +4712,7 @@ void LoadExternalBlockFile(const CChainParams& chainparams, FILE* fileIn, FlatFi
4711
4712
}
4712
4713
range.first ++;
4713
4714
mapBlocksUnknownParent.erase (it);
4714
- NotifyHeaderTip ();
4715
+ NotifyHeaderTip (:: ChainstateActive () );
4715
4716
}
4716
4717
}
4717
4718
} catch (const std::exception& e) {
0 commit comments