diff options
author | Casey Rodarmor <casey@rodarmor.com> | 2015-07-28 17:42:03 -0400 |
---|---|---|
committer | Casey Rodarmor <casey@rodarmor.com> | 2015-08-03 15:11:52 -0400 |
commit | f261f19b4b77de7b2769a62356b4e4165cae6dc8 (patch) | |
tree | 9338290a9aaad9ba40a823e683fe41e83fb0b02e /src | |
parent | 1369d699b6221818dc9ca72eb6c0cea30eeee914 (diff) |
Give a better error message if system clock is bad
Fixes #2007
This checks to see if the system clock appears to be bad and gives a
helpful error message. If the user's clock is set incorrectly, hopefully
they'll abort, fix it, and then save themselves a fruitless resync.
Diffstat (limited to 'src')
-rw-r--r-- | src/init.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/init.cpp b/src/init.cpp index 365bd30714..fc979f059d 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1225,6 +1225,18 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) LogPrintf("Prune: pruned datadir may not have more than %d blocks; -checkblocks=%d may fail\n", MIN_BLOCKS_TO_KEEP, GetArg("-checkblocks", 288)); } + + { + LOCK(cs_main); + CBlockIndex* tip = chainActive.Tip(); + if (tip && tip->nTime > GetAdjustedTime() + 2 * 60 * 60) { + strLoadError = _("The block database contains a block which appears to be from the future. " + "This may be due to your computer's date and time being set incorrectly. " + "Only rebuild the block database if you are sure that your computer's date and time are correct"); + break; + } + } + if (!CVerifyDB().VerifyDB(pcoinsdbview, GetArg("-checklevel", 3), GetArg("-checkblocks", 288))) { strLoadError = _("Corrupted block database detected"); |