mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-02-05 11:44:25 +00:00
Initialize database before checking changed txindex
In case no database exists yet, and -txindex(=1) is passed, we currently first check whether fTxIndex differs from -txindex (and ask the user to reindex in that case), and only afterwards initialize the database. By swapping these around (the initialization is a no-op in case the database already exists), we allow it to be born in txindex mode, without warning. That also means we don't need to check -reindex anymore, as the wiping/reinit of the databases happens before checking.
This commit is contained in:
parent
905738a15a
commit
067a6092ac
12
src/init.cpp
12
src/init.cpp
@ -744,18 +744,18 @@ bool AppInit2(boost::thread_group& threadGroup)
|
|||||||
if (!mapBlockIndex.empty() && pindexGenesisBlock == NULL)
|
if (!mapBlockIndex.empty() && pindexGenesisBlock == NULL)
|
||||||
return InitError(_("Incorrect or no genesis block found. Wrong datadir for network?"));
|
return InitError(_("Incorrect or no genesis block found. Wrong datadir for network?"));
|
||||||
|
|
||||||
// Check for changed -txindex state (only necessary if we are not reindexing anyway)
|
|
||||||
if (!fReindex && fTxIndex != GetBoolArg("-txindex", false)) {
|
|
||||||
strLoadError = _("You need to rebuild the database using -reindex to change -txindex");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initialize the block index (no-op if non-empty database was already loaded)
|
// Initialize the block index (no-op if non-empty database was already loaded)
|
||||||
if (!InitBlockIndex()) {
|
if (!InitBlockIndex()) {
|
||||||
strLoadError = _("Error initializing block database");
|
strLoadError = _("Error initializing block database");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check for changed -txindex state
|
||||||
|
if (fTxIndex != GetBoolArg("-txindex", false)) {
|
||||||
|
strLoadError = _("You need to rebuild the database using -reindex to change -txindex");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
uiInterface.InitMessage(_("Verifying blocks..."));
|
uiInterface.InitMessage(_("Verifying blocks..."));
|
||||||
if (!VerifyDB()) {
|
if (!VerifyDB()) {
|
||||||
strLoadError = _("Corrupted block database detected");
|
strLoadError = _("Corrupted block database detected");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user