@@ -83,7 +83,6 @@ using node::BlockManager;
8383using node::BlockMap;
8484using node::CBlockIndexHeightOnlyComparator;
8585using node::CBlockIndexWorkComparator;
86- using node::fReindex ;
8786using node::SnapshotMetadata;
8887
8988/* * Time to wait between writing blocks/block index to disk. */
@@ -2642,7 +2641,7 @@ bool Chainstate::FlushStateToDisk(
26422641
26432642 CoinsCacheSizeState cache_state = GetCoinsCacheSizeState ();
26442643 LOCK (m_blockman.cs_LastBlockFile );
2645- if (m_blockman.IsPruneMode () && (m_blockman.m_check_for_pruning || nManualPruneHeight > 0 ) && !fReindex ) {
2644+ if (m_blockman.IsPruneMode () && (m_blockman.m_check_for_pruning || nManualPruneHeight > 0 ) && !m_chainman. m_blockman . m_reindexing ) {
26462645 // make sure we don't prune above any of the prune locks bestblocks
26472646 // pruning is height-based
26482647 int last_prune{m_chain.Height ()}; // last height we can prune
@@ -3255,10 +3254,10 @@ bool Chainstate::ActivateBestChainStep(BlockValidationState& state, CBlockIndex*
32553254 return true ;
32563255}
32573256
3258- static SynchronizationState GetSynchronizationState (bool init)
3257+ static SynchronizationState GetSynchronizationState (bool init, bool reindexing )
32593258{
32603259 if (!init) return SynchronizationState::POST_INIT;
3261- if (:: fReindex ) return SynchronizationState::INIT_REINDEX;
3260+ if (reindexing ) return SynchronizationState::INIT_REINDEX;
32623261 return SynchronizationState::INIT_DOWNLOAD;
32633262}
32643263
@@ -3280,7 +3279,7 @@ static bool NotifyHeaderTip(ChainstateManager& chainman) LOCKS_EXCLUDED(cs_main)
32803279 }
32813280 // Send block tip changed notifications without cs_main
32823281 if (fNotify ) {
3283- chainman.GetNotifications ().headerTip (GetSynchronizationState (fInitialBlockDownload ), pindexHeader->nHeight , pindexHeader->nTime , false );
3282+ chainman.GetNotifications ().headerTip (GetSynchronizationState (fInitialBlockDownload , chainman. m_blockman . m_reindexing ), pindexHeader->nHeight , pindexHeader->nTime , false );
32843283 }
32853284 return fNotify ;
32863285}
@@ -3399,7 +3398,7 @@ bool Chainstate::ActivateBestChain(BlockValidationState& state, std::shared_ptr<
33993398 }
34003399
34013400 // Always notify the UI if a new block tip was connected
3402- if (kernel::IsInterrupted (m_chainman.GetNotifications ().blockTip (GetSynchronizationState (still_in_ibd), *pindexNewTip))) {
3401+ if (kernel::IsInterrupted (m_chainman.GetNotifications ().blockTip (GetSynchronizationState (still_in_ibd, m_chainman. m_blockman . m_reindexing ), *pindexNewTip))) {
34033402 // Just breaking and returning success for now. This could
34043403 // be changed to bubble up the kernel::Interrupted value to
34053404 // the caller so the caller could distinguish between
@@ -3625,7 +3624,7 @@ bool Chainstate::InvalidateBlock(BlockValidationState& state, CBlockIndex* pinde
36253624 // parameter indicating the source of the tip change so hooks can
36263625 // distinguish user-initiated invalidateblock changes from other
36273626 // changes.
3628- (void )m_chainman.GetNotifications ().blockTip (GetSynchronizationState (m_chainman.IsInitialBlockDownload ()), *to_mark_failed->pprev );
3627+ (void )m_chainman.GetNotifications ().blockTip (GetSynchronizationState (m_chainman.IsInitialBlockDownload (), m_chainman. m_blockman . m_reindexing ), *to_mark_failed->pprev );
36293628 }
36303629 return true ;
36313630}
@@ -4264,7 +4263,7 @@ void ChainstateManager::ReportHeadersPresync(const arith_uint256& work, int64_t
42644263 m_last_presync_update = now;
42654264 }
42664265 bool initial_download = IsInitialBlockDownload ();
4267- GetNotifications ().headerTip (GetSynchronizationState (initial_download), height, timestamp, /* presync=*/ true );
4266+ GetNotifications ().headerTip (GetSynchronizationState (initial_download, m_blockman. m_reindexing ), height, timestamp, /* presync=*/ true );
42684267 if (initial_download) {
42694268 int64_t blocks_left{(NodeClock::now () - NodeSeconds{std::chrono::seconds{timestamp}}) / GetConsensus ().PowTargetSpacing ()};
42704269 blocks_left = std::max<int64_t >(0 , blocks_left);
@@ -4785,8 +4784,8 @@ bool ChainstateManager::LoadBlockIndex()
47854784{
47864785 AssertLockHeld (cs_main);
47874786 // Load block index from databases
4788- bool needs_init = fReindex ;
4789- if (!fReindex ) {
4787+ bool needs_init = m_blockman. m_reindexing ;
4788+ if (!m_blockman. m_reindexing ) {
47904789 bool ret{m_blockman.LoadBlockIndexDB (SnapshotBlockhash ())};
47914790 if (!ret) return false ;
47924791
@@ -4823,8 +4822,8 @@ bool ChainstateManager::LoadBlockIndex()
48234822
48244823 if (needs_init) {
48254824 // Everything here is for *new* reindex/DBs. Thus, though
4826- // LoadBlockIndexDB may have set fReindex if we shut down
4827- // mid-reindex previously, we don't check fReindex and
4825+ // LoadBlockIndexDB may have set m_reindexing if we shut down
4826+ // mid-reindex previously, we don't check m_reindexing and
48284827 // instead only check it prior to LoadBlockIndexDB to set
48294828 // needs_init.
48304829
@@ -4969,7 +4968,7 @@ void ChainstateManager::LoadExternalBlockFile(
49694968 }
49704969 }
49714970
4972- if (m_blockman.IsPruneMode () && !fReindex && pblock) {
4971+ if (m_blockman.IsPruneMode () && !m_blockman. m_reindexing && pblock) {
49734972 // must update the tip for pruning to work while importing with -loadblock.
49744973 // this is a tradeoff to conserve disk space at the expense of time
49754974 // spent updating the tip to be able to prune.
0 commit comments