@@ -1400,9 +1400,9 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
1400
1400
delete pcoinscatcher;
1401
1401
delete pblocktree;
1402
1402
1403
- pblocktree = new CBlockTreeDB (nBlockTreeDBCache, false , fReindex );
1403
+ pblocktree = new CBlockTreeDB (nBlockTreeDBCache, false , fReset );
1404
1404
1405
- if (fReindex ) {
1405
+ if (fReset ) {
1406
1406
pblocktree->WriteReindexing (true );
1407
1407
// If we're reindexing in prune mode, wipe away unusable block files and all undo data files
1408
1408
if (fPruneMode )
@@ -1414,6 +1414,8 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
1414
1414
// LoadBlockIndex will load fTxIndex from the db, or set it if
1415
1415
// we're reindexing. It will also load fHavePruned if we've
1416
1416
// 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!
1417
1419
if (!LoadBlockIndex (chainparams)) {
1418
1420
strLoadError = _ (" Error loading block database" );
1419
1421
break ;
@@ -1448,7 +1450,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
1448
1450
// At this point we're either in reindex or we've loaded a useful
1449
1451
// block tree into mapBlockIndex!
1450
1452
1451
- pcoinsdbview = new CCoinsViewDB (nCoinDBCache, false , fReindex || fReindexChainState );
1453
+ pcoinsdbview = new CCoinsViewDB (nCoinDBCache, false , fReset || fReindexChainState );
1452
1454
pcoinscatcher = new CCoinsViewErrorCatcher (pcoinsdbview);
1453
1455
1454
1456
// If necessary, upgrade from older database format.
@@ -1467,7 +1469,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
1467
1469
// The on-disk coinsdb is now in a good state, create the cache
1468
1470
pcoinsTip = new CCoinsViewCache (pcoinscatcher);
1469
1471
1470
- if (!fReindex && !fReindexChainState ) {
1472
+ if (!fReset && !fReindexChainState ) {
1471
1473
// LoadChainTip sets chainActive based on pcoinsTip's best block
1472
1474
if (!LoadChainTip (chainparams)) {
1473
1475
strLoadError = _ (" Error initializing block database" );
@@ -1476,7 +1478,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
1476
1478
assert (chainActive.Tip () != NULL );
1477
1479
}
1478
1480
1479
- if (!fReindex ) {
1481
+ if (!fReset ) {
1480
1482
// Note that RewindBlockIndex MUST run even if we're about to -reindex-chainstate.
1481
1483
// It both disconnects blocks based on chainActive, and drops block data in
1482
1484
// mapBlockIndex based on lack of available witness data.
@@ -1487,7 +1489,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
1487
1489
}
1488
1490
}
1489
1491
1490
- if (!fReindex && !fReindexChainState ) {
1492
+ if (!fReset && !fReindexChainState ) {
1491
1493
uiInterface.InitMessage (_ (" Verifying blocks..." ));
1492
1494
if (fHavePruned && GetArg (" -checkblocks" , DEFAULT_CHECKBLOCKS) > MIN_BLOCKS_TO_KEEP) {
1493
1495
LogPrintf (" Prune: pruned datadir may not have more than %d blocks; only checking available blocks" ,
0 commit comments