aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2013-01-30 21:43:36 +0100
committerPieter Wuille <pieter.wuille@gmail.com>2013-02-01 23:29:59 +0100
commit386037615ae02f972287a958d22a5bd2760626a7 (patch)
tree308156e618b67b34bd7eb07b1338f16e41729d10 /src/init.cpp
parent3d29d5d623c03a26177176a9b422cb00dedd9108 (diff)
Make sure the genesis block is present after reindex
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 2f37dad56c..15a46946fa 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -365,6 +365,8 @@ void ThreadImport(void *data) {
pblocktree->WriteReindexing(false);
fReindex = false;
printf("Reindexing finished\n");
+ // To avoid ending up in a situation without genesis block, re-try initializing (no-op if reindexing worked):
+ InitBlockIndex();
}
}
@@ -802,6 +804,10 @@ bool AppInit2()
if (!LoadBlockIndex())
return InitError(_("Error loading block database"));
+ // Initialize the block index (no-op if non-empty database was already loaded)
+ if (!InitBlockIndex())
+ return InitError(_("Error initializing block database"));
+
uiInterface.InitMessage(_("Verifying block database integrity..."));
if (!VerifyDB())