@@ -45,11 +45,12 @@ static ChainstateLoadResult CompleteChainstateInitialization(
4545 .path = chainman.m_options .datadir / " blocks" / " index" ,
4646 .cache_bytes = static_cast <size_t >(cache_sizes.block_tree_db ),
4747 .memory_only = options.block_tree_db_in_memory ,
48- .wipe_data = options.reindex ,
48+ .wipe_data = options.wipe_block_tree_db ,
4949 .options = chainman.m_options .block_tree_db });
5050
51- if (options.reindex ) {
51+ if (options.wipe_block_tree_db ) {
5252 pblocktree->WriteReindexing (true );
53+ chainman.m_blockman .m_reindexing = true ;
5354 // If we're reindexing in prune mode, wipe away unusable block files and all undo data files
5455 if (options.prune ) {
5556 chainman.m_blockman .CleanupBlockRevFiles ();
@@ -61,7 +62,6 @@ static ChainstateLoadResult CompleteChainstateInitialization(
6162 // LoadBlockIndex will load m_have_pruned if we've ever removed a
6263 // block file from disk.
6364 // Note that it also sets m_reindexing based on the disk flag!
64- // From here on, m_reindexing and options.reindex values may be different!
6565 if (!chainman.LoadBlockIndex ()) {
6666 if (chainman.m_interrupt ) return {ChainstateLoadStatus::INTERRUPTED, {}};
6767 return {ChainstateLoadStatus::FAILURE, _ (" Error loading block database" )};
@@ -89,7 +89,7 @@ static ChainstateLoadResult CompleteChainstateInitialization(
8989 }
9090
9191 auto is_coinsview_empty = [&](Chainstate* chainstate) EXCLUSIVE_LOCKS_REQUIRED (::cs_main) {
92- return options.reindex || options. reindex_chainstate || chainstate->CoinsTip ().GetBestBlock ().IsNull ();
92+ return options.wipe_chainstate_db || chainstate->CoinsTip ().GetBestBlock ().IsNull ();
9393 };
9494
9595 assert (chainman.m_total_coinstip_cache > 0 );
@@ -110,7 +110,7 @@ static ChainstateLoadResult CompleteChainstateInitialization(
110110 chainstate->InitCoinsDB (
111111 /* cache_size_bytes=*/ chainman.m_total_coinsdb_cache * init_cache_fraction,
112112 /* in_memory=*/ options.coins_db_in_memory ,
113- /* should_wipe=*/ options.reindex || options. reindex_chainstate );
113+ /* should_wipe=*/ options.wipe_chainstate_db );
114114
115115 if (options.coins_error_cb ) {
116116 chainstate->CoinsErrorCatcher ().AddReadErrCallback (options.coins_error_cb );
@@ -142,7 +142,7 @@ static ChainstateLoadResult CompleteChainstateInitialization(
142142 }
143143 }
144144
145- if (!options.reindex ) {
145+ if (!options.wipe_block_tree_db ) {
146146 auto chainstates{chainman.GetAll ()};
147147 if (std::any_of (chainstates.begin (), chainstates.end (),
148148 [](const Chainstate* cs) EXCLUSIVE_LOCKS_REQUIRED (cs_main) { return cs->NeedsRedownload (); })) {
@@ -188,7 +188,7 @@ ChainstateLoadResult LoadChainstate(ChainstateManager& chainman, const CacheSize
188188 // Load a chain created from a UTXO snapshot, if any exist.
189189 bool has_snapshot = chainman.DetectSnapshotChainstate ();
190190
191- if (has_snapshot && ( options.reindex || options. reindex_chainstate ) ) {
191+ if (has_snapshot && options.wipe_chainstate_db ) {
192192 LogPrintf (" [snapshot] deleting snapshot chainstate due to reindexing\n " );
193193 if (!chainman.DeleteSnapshotChainstate ()) {
194194 return {ChainstateLoadStatus::FAILURE_FATAL, Untranslated (" Couldn't remove snapshot chainstate." )};
@@ -247,7 +247,7 @@ ChainstateLoadResult LoadChainstate(ChainstateManager& chainman, const CacheSize
247247ChainstateLoadResult VerifyLoadedChainstate (ChainstateManager& chainman, const ChainstateLoadOptions& options)
248248{
249249 auto is_coinsview_empty = [&](Chainstate* chainstate) EXCLUSIVE_LOCKS_REQUIRED (::cs_main) {
250- return options.reindex || options. reindex_chainstate || chainstate->CoinsTip ().GetBestBlock ().IsNull ();
250+ return options.wipe_chainstate_db || chainstate->CoinsTip ().GetBestBlock ().IsNull ();
251251 };
252252
253253 LOCK (cs_main);
0 commit comments