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
2016-03-18 17:20:12 +01:00
parent b7dbeb24eb
commit 6032f6930a
4 changed files with 124 additions and 17 deletions

View File

@@ -1284,6 +1284,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", DEFAULT_CHECKBLOCKS) > MIN_BLOCKS_TO_KEEP) {
LogPrintf("Prune: pruned datadir may not have more than %d blocks; only checking available blocks",