Add rewind logic to deal with post-fork software updates

Includes logic for dealing with pruning by Suhas Daftuar.
This commit is contained in:
Pieter Wuille
2018-02-04 22:58:42 +00:00
committed by Jack Grigg
parent f52da91139
commit 89f20450c2
4 changed files with 122 additions and 15 deletions
+8
View File
@@ -1422,6 +1422,14 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
break;
}
if (!fReindex) {
uiInterface.InitMessage(_("Rewinding blocks..."));
if (!RewindBlockIndex(chainparams)) {
strLoadError = _("Unable to rewind the database to a pre-fork state. You will need to redownload the blockchain");
break;
}
}
uiInterface.InitMessage(_("Verifying blocks..."));
if (fHavePruned && GetArg("-checkblocks", 288) > MIN_BLOCKS_TO_KEEP) {
LogPrintf("Prune: pruned datadir may not have more than %d blocks; -checkblocks=%d may fail\n",