Changeset View
Changeset View
Standalone View
Standalone View
src/init.cpp
Show First 20 Lines • Show All 1,001 Lines • ▼ Show 20 Lines | void ThreadImport(const Config &config, std::vector<fs::path> vImportFiles) { | ||||
{ | { | ||||
CImportingNow imp; | CImportingNow imp; | ||||
// -reindex | // -reindex | ||||
if (fReindex) { | if (fReindex) { | ||||
int nFile = 0; | int nFile = 0; | ||||
while (true) { | while (true) { | ||||
CDiskBlockPos pos(nFile, 0); | CDiskBlockPos pos(nFile, 0); | ||||
if (!fs::exists(GetBlockPosFilename(pos, "blk"))) | if (!fs::exists(GetBlockPosFilename(pos, "blk"))) { | ||||
break; // No block files left to reindex | // No block files left to reindex | ||||
break; | |||||
} | |||||
FILE *file = OpenBlockFile(pos, true); | FILE *file = OpenBlockFile(pos, true); | ||||
if (!file) break; // This error is logged in OpenBlockFile | if (!file) { | ||||
// This error is logged in OpenBlockFile | |||||
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); | ||||
nFile++; | nFile++; | ||||
} | } | ||||
pblocktree->WriteReindexing(false); | pblocktree->WriteReindexing(false); | ||||
fReindex = false; | fReindex = false; | ||||
LogPrintf("Reindexing finished\n"); | LogPrintf("Reindexing finished\n"); | ||||
▲ Show 20 Lines • Show All 1,237 Lines • Show Last 20 Lines |