aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorJoão Barbosa <joao.paulo.barbosa@gmail.com>2018-01-11 23:34:47 +0000
committerJoão Barbosa <joao.paulo.barbosa@gmail.com>2018-03-06 19:21:15 +0000
commitc651df8b32d82695b497c969bfc9f2b1374081a8 (patch)
tree5a401c99f243d6cfc84af803444c2fdd4e0e576a /src/init.cpp
parent02de6a6bcda8bef4c35eb6c5135529fdf51f0f88 (diff)
Lock cs_main while loading block index in AppInitMain
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/init.cpp b/src/init.cpp
index f763c3a435..fdc2917dcf 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -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),