Skip to content

Commit

Permalink
Move ReindexAccumulators() call to be inside parent conditional
Browse files Browse the repository at this point in the history
Not much point in checking if the listAccCheckpointsNoDB list is empty
outside of when the wallet is started using `-reindexaccumulators`, as
it is always empty outside of that case.
  • Loading branch information
Fuzzbawls committed Jun 26, 2018
1 parent bed79e2 commit 5127486
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1130,7 +1130,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
filesystem::path chainstateDir = GetDataDir() / "chainstate";
filesystem::path sporksDir = GetDataDir() / "sporks";
filesystem::path zerocoinDir = GetDataDir() / "zerocoin";

LogPrintf("Deleting blockchain folders blocks, chainstate, sporks and zerocoin\n");
// We delete in 4 individual steps in case one of the folder is missing already
try {
Expand Down Expand Up @@ -1466,19 +1466,18 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
listAccCheckpointsNoDB.emplace_back(pindex->nAccumulatorCheckpoint);
pindex = chainActive.Next(pindex);
}
// PIVX: recalculate Accumulator Checkpoints that failed to database properly
if (!listAccCheckpointsNoDB.empty()) {
uiInterface.InitMessage(_("Calculating missing accumulators..."));
LogPrintf("%s : finding missing checkpoints\n", __func__);

string strError;
if (!ReindexAccumulators(listAccCheckpointsNoDB, strError))
return InitError(strError);
}
}
}

// PIVX: recalculate Accumulator Checkpoints that failed to database properly
if (!listAccCheckpointsNoDB.empty()) {
uiInterface.InitMessage(_("Calculating missing accumulators..."));
LogPrintf("%s : finding missing checkpoints\n", __func__);

string strError;
if (!ReindexAccumulators(listAccCheckpointsNoDB, strError))
return InitError(strError);
}

uiInterface.InitMessage(_("Verifying blocks..."));

// Flag sent to validation code to let it know it can skip certain checks
Expand Down

0 comments on commit 5127486

Please sign in to comment.