Support testnet rollback.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
@@ -1443,6 +1443,8 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||
LogPrintf("* Using %.1fMiB for chain state database\n", nCoinDBCache * (1.0 / 1024 / 1024));
|
||||
LogPrintf("* Using %.1fMiB for in-memory UTXO set\n", nCoinCacheUsage * (1.0 / 1024 / 1024));
|
||||
|
||||
bool clearWitnessCaches = false;
|
||||
|
||||
bool fLoaded = false;
|
||||
while (!fLoaded) {
|
||||
bool fReset = fReindex;
|
||||
@@ -1502,7 +1504,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||
|
||||
if (!fReindex) {
|
||||
uiInterface.InitMessage(_("Rewinding blocks if needed..."));
|
||||
if (!RewindBlockIndex(chainparams)) {
|
||||
if (!RewindBlockIndex(chainparams, clearWitnessCaches)) {
|
||||
strLoadError = _("Unable to rewind the database to a pre-upgrade state. You will need to redownload the blockchain");
|
||||
break;
|
||||
}
|
||||
@@ -1652,7 +1654,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||
RegisterValidationInterface(pwalletMain);
|
||||
|
||||
CBlockIndex *pindexRescan = chainActive.Tip();
|
||||
if (GetBoolArg("-rescan", false))
|
||||
if (clearWitnessCaches || GetBoolArg("-rescan", false))
|
||||
{
|
||||
pwalletMain->ClearNoteWitnessCache();
|
||||
pindexRescan = chainActive.Genesis();
|
||||
|
||||
Reference in New Issue
Block a user