Changeset View
Changeset View
Standalone View
Standalone View
src/init.cpp
Show First 20 Lines • Show All 1,363 Lines • ▼ Show 20 Lines | ScheduleBatchPriority(); | ||||
FILE *file = OpenBlockFile(pos, true); | FILE *file = OpenBlockFile(pos, true); | ||||
if (!file) { | if (!file) { | ||||
// This error is logged in OpenBlockFile | // This error is logged in OpenBlockFile | ||||
break; | break; | ||||
} | } | ||||
LogPrintf("Reindexing block file blk%05u.dat...\n", | LogPrintf("Reindexing block file blk%05u.dat...\n", | ||||
(unsigned int)nFile); | (unsigned int)nFile); | ||||
LoadExternalBlockFile(config, file, &pos); | LoadExternalBlockFile(config, file, &pos); | ||||
if (ShutdownRequested()) { | |||||
LogPrintf("Shutdown requested. Exit %s\n", __func__); | |||||
return; | |||||
} | |||||
nFile++; | nFile++; | ||||
} | } | ||||
pblocktree->WriteReindexing(false); | pblocktree->WriteReindexing(false); | ||||
fReindex = false; | fReindex = false; | ||||
LogPrintf("Reindexing finished\n"); | LogPrintf("Reindexing finished\n"); | ||||
// To avoid ending up in a situation without genesis block, re-try | // To avoid ending up in a situation without genesis block, re-try | ||||
// initializing (no-op if reindexing worked): | // initializing (no-op if reindexing worked): | ||||
LoadGenesisBlock(chainParams); | LoadGenesisBlock(chainParams); | ||||
} | } | ||||
// -loadblock= | // -loadblock= | ||||
for (const fs::path &path : vImportFiles) { | for (const fs::path &path : vImportFiles) { | ||||
FILE *file = fsbridge::fopen(path, "rb"); | FILE *file = fsbridge::fopen(path, "rb"); | ||||
if (file) { | if (file) { | ||||
LogPrintf("Importing blocks file %s...\n", path.string()); | LogPrintf("Importing blocks file %s...\n", path.string()); | ||||
LoadExternalBlockFile(config, file); | LoadExternalBlockFile(config, file); | ||||
if (ShutdownRequested()) { | |||||
LogPrintf("Shutdown requested. Exit %s\n", __func__); | |||||
return; | |||||
} | |||||
} else { | } else { | ||||
LogPrintf("Warning: Could not open blocks file %s\n", | LogPrintf("Warning: Could not open blocks file %s\n", | ||||
path.string()); | path.string()); | ||||
} | } | ||||
} | } | ||||
// Reconsider blocks we know are valid. They may have been marked | // Reconsider blocks we know are valid. They may have been marked | ||||
// invalid by, for instance, running an outdated version of the node | // invalid by, for instance, running an outdated version of the node | ||||
▲ Show 20 Lines • Show All 1,562 Lines • Show Last 20 Lines |