Skip to content

Commit c9c017a

Browse files
committed
Merge pull request #6489
f261f19 Give a better error message if system clock is bad (Casey Rodarmor)
2 parents 9bb4dd8 + f261f19 commit c9c017a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/init.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,6 +1230,18 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
12301230
LogPrintf("Prune: pruned datadir may not have more than %d blocks; -checkblocks=%d may fail\n",
12311231
MIN_BLOCKS_TO_KEEP, GetArg("-checkblocks", 288));
12321232
}
1233+
1234+
{
1235+
LOCK(cs_main);
1236+
CBlockIndex* tip = chainActive.Tip();
1237+
if (tip && tip->nTime > GetAdjustedTime() + 2 * 60 * 60) {
1238+
strLoadError = _("The block database contains a block which appears to be from the future. "
1239+
"This may be due to your computer's date and time being set incorrectly. "
1240+
"Only rebuild the block database if you are sure that your computer's date and time are correct");
1241+
break;
1242+
}
1243+
}
1244+
12331245
if (!CVerifyDB().VerifyDB(pcoinsdbview, GetArg("-checklevel", 3),
12341246
GetArg("-checkblocks", 288))) {
12351247
strLoadError = _("Corrupted block database detected");

0 commit comments

Comments
 (0)