mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-26 19:23:26 -03:00
Lock cs_main while loading block index in AppInitMain
This commit is contained in:
parent
02de6a6bcd
commit
c651df8b32
1 changed files with 9 additions and 10 deletions
19
src/init.cpp
19
src/init.cpp
|
@ -1424,6 +1424,8 @@ bool AppInitMain()
|
||||||
|
|
||||||
uiInterface.InitMessage(_("Loading block index..."));
|
uiInterface.InitMessage(_("Loading block index..."));
|
||||||
|
|
||||||
|
LOCK(cs_main);
|
||||||
|
|
||||||
nStart = GetTimeMillis();
|
nStart = GetTimeMillis();
|
||||||
do {
|
do {
|
||||||
try {
|
try {
|
||||||
|
@ -1532,16 +1534,13 @@ bool AppInitMain()
|
||||||
MIN_BLOCKS_TO_KEEP);
|
MIN_BLOCKS_TO_KEEP);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
CBlockIndex* tip = chainActive.Tip();
|
||||||
LOCK(cs_main);
|
RPCNotifyBlockChange(true, tip);
|
||||||
CBlockIndex* tip = chainActive.Tip();
|
if (tip && tip->nTime > GetAdjustedTime() + 2 * 60 * 60) {
|
||||||
RPCNotifyBlockChange(true, tip);
|
strLoadError = _("The block database contains a block which appears to be from the future. "
|
||||||
if (tip && tip->nTime > GetAdjustedTime() + 2 * 60 * 60) {
|
"This may be due to your computer's date and time being set incorrectly. "
|
||||||
strLoadError = _("The block database contains a block which appears to be from the future. "
|
"Only rebuild the block database if you are sure that your computer's date and time are correct");
|
||||||
"This may be due to your computer's date and time being set incorrectly. "
|
break;
|
||||||
"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),
|
if (!CVerifyDB().VerifyDB(chainparams, pcoinsdbview.get(), gArgs.GetArg("-checklevel", DEFAULT_CHECKLEVEL),
|
||||||
|
|
Loading…
Add table
Reference in a new issue