@@ -1400,9 +1400,9 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
14001400 delete pcoinscatcher;
14011401 delete pblocktree;
14021402
1403- pblocktree = new CBlockTreeDB (nBlockTreeDBCache, false , fReindex );
1403+ pblocktree = new CBlockTreeDB (nBlockTreeDBCache, false , fReset );
14041404
1405- if (fReindex ) {
1405+ if (fReset ) {
14061406 pblocktree->WriteReindexing (true );
14071407 // If we're reindexing in prune mode, wipe away unusable block files and all undo data files
14081408 if (fPruneMode )
@@ -1414,6 +1414,8 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
14141414 // LoadBlockIndex will load fTxIndex from the db, or set it if
14151415 // we're reindexing. It will also load fHavePruned if we've
14161416 // ever removed a block file from disk.
1417+ // Note that it also sets fReindex based on the disk flag!
1418+ // From here on out fReindex and fReset mean something different!
14171419 if (!LoadBlockIndex (chainparams)) {
14181420 strLoadError = _ (" Error loading block database" );
14191421 break ;
@@ -1448,7 +1450,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
14481450 // At this point we're either in reindex or we've loaded a useful
14491451 // block tree into mapBlockIndex!
14501452
1451- pcoinsdbview = new CCoinsViewDB (nCoinDBCache, false , fReindex || fReindexChainState );
1453+ pcoinsdbview = new CCoinsViewDB (nCoinDBCache, false , fReset || fReindexChainState );
14521454 pcoinscatcher = new CCoinsViewErrorCatcher (pcoinsdbview);
14531455
14541456 // If necessary, upgrade from older database format.
@@ -1467,7 +1469,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
14671469 // The on-disk coinsdb is now in a good state, create the cache
14681470 pcoinsTip = new CCoinsViewCache (pcoinscatcher);
14691471
1470- if (!fReindex && !fReindexChainState ) {
1472+ if (!fReset && !fReindexChainState ) {
14711473 // LoadChainTip sets chainActive based on pcoinsTip's best block
14721474 if (!LoadChainTip (chainparams)) {
14731475 strLoadError = _ (" Error initializing block database" );
@@ -1476,7 +1478,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
14761478 assert (chainActive.Tip () != NULL );
14771479 }
14781480
1479- if (!fReindex ) {
1481+ if (!fReset ) {
14801482 // Note that RewindBlockIndex MUST run even if we're about to -reindex-chainstate.
14811483 // It both disconnects blocks based on chainActive, and drops block data in
14821484 // mapBlockIndex based on lack of available witness data.
@@ -1487,7 +1489,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
14871489 }
14881490 }
14891491
1490- if (!fReindex && !fReindexChainState ) {
1492+ if (!fReset && !fReindexChainState ) {
14911493 uiInterface.InitMessage (_ (" Verifying blocks..." ));
14921494 if (fHavePruned && GetArg (" -checkblocks" , DEFAULT_CHECKBLOCKS) > MIN_BLOCKS_TO_KEEP) {
14931495 LogPrintf (" Prune: pruned datadir may not have more than %d blocks; only checking available blocks" ,
0 commit comments