@@ -45,11 +45,12 @@ static ChainstateLoadResult CompleteChainstateInitialization(
45
45
.path = chainman.m_options .datadir / " blocks" / " index" ,
46
46
.cache_bytes = static_cast <size_t >(cache_sizes.block_tree_db ),
47
47
.memory_only = options.block_tree_db_in_memory ,
48
- .wipe_data = options.reindex ,
48
+ .wipe_data = options.wipe_block_tree_db ,
49
49
.options = chainman.m_options .block_tree_db });
50
50
51
- if (options.reindex ) {
51
+ if (options.wipe_block_tree_db ) {
52
52
pblocktree->WriteReindexing (true );
53
+ chainman.m_blockman .m_reindexing = true ;
53
54
// If we're reindexing in prune mode, wipe away unusable block files and all undo data files
54
55
if (options.prune ) {
55
56
chainman.m_blockman .CleanupBlockRevFiles ();
@@ -61,7 +62,6 @@ static ChainstateLoadResult CompleteChainstateInitialization(
61
62
// LoadBlockIndex will load m_have_pruned if we've ever removed a
62
63
// block file from disk.
63
64
// 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!
65
65
if (!chainman.LoadBlockIndex ()) {
66
66
if (chainman.m_interrupt ) return {ChainstateLoadStatus::INTERRUPTED, {}};
67
67
return {ChainstateLoadStatus::FAILURE, _ (" Error loading block database" )};
@@ -89,7 +89,7 @@ static ChainstateLoadResult CompleteChainstateInitialization(
89
89
}
90
90
91
91
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 ();
93
93
};
94
94
95
95
assert (chainman.m_total_coinstip_cache > 0 );
@@ -110,7 +110,7 @@ static ChainstateLoadResult CompleteChainstateInitialization(
110
110
chainstate->InitCoinsDB (
111
111
/* cache_size_bytes=*/ chainman.m_total_coinsdb_cache * init_cache_fraction,
112
112
/* in_memory=*/ options.coins_db_in_memory ,
113
- /* should_wipe=*/ options.reindex || options. reindex_chainstate );
113
+ /* should_wipe=*/ options.wipe_chainstate_db );
114
114
115
115
if (options.coins_error_cb ) {
116
116
chainstate->CoinsErrorCatcher ().AddReadErrCallback (options.coins_error_cb );
@@ -142,7 +142,7 @@ static ChainstateLoadResult CompleteChainstateInitialization(
142
142
}
143
143
}
144
144
145
- if (!options.reindex ) {
145
+ if (!options.wipe_block_tree_db ) {
146
146
auto chainstates{chainman.GetAll ()};
147
147
if (std::any_of (chainstates.begin (), chainstates.end (),
148
148
[](const Chainstate* cs) EXCLUSIVE_LOCKS_REQUIRED (cs_main) { return cs->NeedsRedownload (); })) {
@@ -188,7 +188,7 @@ ChainstateLoadResult LoadChainstate(ChainstateManager& chainman, const CacheSize
188
188
// Load a chain created from a UTXO snapshot, if any exist.
189
189
bool has_snapshot = chainman.DetectSnapshotChainstate ();
190
190
191
- if (has_snapshot && ( options.reindex || options. reindex_chainstate ) ) {
191
+ if (has_snapshot && options.wipe_chainstate_db ) {
192
192
LogPrintf (" [snapshot] deleting snapshot chainstate due to reindexing\n " );
193
193
if (!chainman.DeleteSnapshotChainstate ()) {
194
194
return {ChainstateLoadStatus::FAILURE_FATAL, Untranslated (" Couldn't remove snapshot chainstate." )};
@@ -247,7 +247,7 @@ ChainstateLoadResult LoadChainstate(ChainstateManager& chainman, const CacheSize
247
247
ChainstateLoadResult VerifyLoadedChainstate (ChainstateManager& chainman, const ChainstateLoadOptions& options)
248
248
{
249
249
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 ();
251
251
};
252
252
253
253
LOCK (cs_main);
0 commit comments