Lock cs_main while loading block index in AppInitMain

This commit is contained in:
João Barbosa 2018-01-11 23:34:47 +00:00
parent 02de6a6bcd
commit c651df8b32

View file

@ -1424,6 +1424,8 @@ bool AppInitMain()
uiInterface.InitMessage(_("Loading block index..."));
LOCK(cs_main);
nStart = GetTimeMillis();
do {
try {
@ -1532,16 +1534,13 @@ bool AppInitMain()
MIN_BLOCKS_TO_KEEP);
}
{
LOCK(cs_main);
CBlockIndex* tip = chainActive.Tip();
RPCNotifyBlockChange(true, 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;
}
CBlockIndex* tip = chainActive.Tip();
RPCNotifyBlockChange(true, 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(chainparams, pcoinsdbview.get(), gArgs.GetArg("-checklevel", DEFAULT_CHECKLEVEL),