From 5127486481e10fc00a9e4d73a9e0bb75e2927305 Mon Sep 17 00:00:00 2001 From: Fuzzbawls Date: Mon, 25 Jun 2018 19:27:59 -0700 Subject: [PATCH] Move ReindexAccumulators() call to be inside parent conditional 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. --- src/init.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index 1862eb23c609c..b1aa7389acf85 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -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 { @@ -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