Make sure the genesis block is present after reindex

This commit is contained in:
Pieter Wuille
2013-01-30 21:43:36 +01:00
parent 3d29d5d623
commit 386037615a
4 changed files with 36 additions and 20 deletions

View File

@@ -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())