Merge pull request #7053
2e29e7e Globals: Remove a bunch of Params() calls from main.cpp: (Jorge Timón)
This commit is contained in:
15
src/init.cpp
15
src/init.cpp
@@ -592,6 +592,7 @@ void CleanupBlockRevFiles()
|
||||
|
||||
void ThreadImport(std::vector<boost::filesystem::path> vImportFiles)
|
||||
{
|
||||
const CChainParams& chainparams = Params();
|
||||
RenameThread("bitcoin-loadblk");
|
||||
// -reindex
|
||||
if (fReindex) {
|
||||
@@ -605,14 +606,14 @@ void ThreadImport(std::vector<boost::filesystem::path> vImportFiles)
|
||||
if (!file)
|
||||
break; // This error is logged in OpenBlockFile
|
||||
LogPrintf("Reindexing block file blk%05u.dat...\n", (unsigned int)nFile);
|
||||
LoadExternalBlockFile(file, &pos);
|
||||
LoadExternalBlockFile(chainparams, file, &pos);
|
||||
nFile++;
|
||||
}
|
||||
pblocktree->WriteReindexing(false);
|
||||
fReindex = false;
|
||||
LogPrintf("Reindexing finished\n");
|
||||
// To avoid ending up in a situation without genesis block, re-try initializing (no-op if reindexing worked):
|
||||
InitBlockIndex();
|
||||
InitBlockIndex(chainparams);
|
||||
}
|
||||
|
||||
// hardcoded $DATADIR/bootstrap.dat
|
||||
@@ -623,7 +624,7 @@ void ThreadImport(std::vector<boost::filesystem::path> vImportFiles)
|
||||
CImportingNow imp;
|
||||
boost::filesystem::path pathBootstrapOld = GetDataDir() / "bootstrap.dat.old";
|
||||
LogPrintf("Importing bootstrap.dat...\n");
|
||||
LoadExternalBlockFile(file);
|
||||
LoadExternalBlockFile(chainparams, file);
|
||||
RenameOver(pathBootstrap, pathBootstrapOld);
|
||||
} else {
|
||||
LogPrintf("Warning: Could not open bootstrap file %s\n", pathBootstrap.string());
|
||||
@@ -636,7 +637,7 @@ void ThreadImport(std::vector<boost::filesystem::path> vImportFiles)
|
||||
if (file) {
|
||||
CImportingNow imp;
|
||||
LogPrintf("Importing blocks file %s...\n", path.string());
|
||||
LoadExternalBlockFile(file);
|
||||
LoadExternalBlockFile(chainparams, file);
|
||||
} else {
|
||||
LogPrintf("Warning: Could not open blocks file %s\n", path.string());
|
||||
}
|
||||
@@ -1301,7 +1302,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||
return InitError(_("Incorrect or no genesis block found. Wrong datadir for network?"));
|
||||
|
||||
// Initialize the block index (no-op if non-empty database was already loaded)
|
||||
if (!InitBlockIndex()) {
|
||||
if (!InitBlockIndex(chainparams)) {
|
||||
strLoadError = _("Error initializing block database");
|
||||
break;
|
||||
}
|
||||
@@ -1336,7 +1337,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||
}
|
||||
}
|
||||
|
||||
if (!CVerifyDB().VerifyDB(pcoinsdbview, GetArg("-checklevel", DEFAULT_CHECKLEVEL),
|
||||
if (!CVerifyDB().VerifyDB(chainparams, pcoinsdbview, GetArg("-checklevel", DEFAULT_CHECKLEVEL),
|
||||
GetArg("-checkblocks", DEFAULT_CHECKBLOCKS))) {
|
||||
strLoadError = _("Corrupted block database detected");
|
||||
break;
|
||||
@@ -1560,7 +1561,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||
uiInterface.InitMessage(_("Activating best chain..."));
|
||||
// scan for better chains in the block chain database, that are not yet connected in the active best chain
|
||||
CValidationState state;
|
||||
if (!ActivateBestChain(state))
|
||||
if (!ActivateBestChain(state, chainparams))
|
||||
strErrors << "Failed to connect best block";
|
||||
|
||||
std::vector<boost::filesystem::path> vImportFiles;
|
||||
|
||||
Reference in New Issue
Block a user