Changeset View
Changeset View
Standalone View
Standalone View
src/node/blockstorage.cpp
Show First 20 Lines • Show All 152 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); | ||||
::ChainstateActive().LoadExternalBlockFile(config, file, &pos); | chainman.ActiveChainstate().LoadExternalBlockFile(config, file, | ||||
&pos); | |||||
if (ShutdownRequested()) { | if (ShutdownRequested()) { | ||||
LogPrintf("Shutdown requested. Exit %s\n", __func__); | LogPrintf("Shutdown requested. Exit %s\n", __func__); | ||||
return; | 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): | ||||
::ChainstateActive().LoadGenesisBlock(chainParams); | chainman.ActiveChainstate().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", | LogPrintf("Importing blocks file %s...\n", | ||||
fs::PathToString(path)); | fs::PathToString(path)); | ||||
::ChainstateActive().LoadExternalBlockFile(config, file); | chainman.ActiveChainstate().LoadExternalBlockFile(config, file); | ||||
if (ShutdownRequested()) { | if (ShutdownRequested()) { | ||||
LogPrintf("Shutdown requested. Exit %s\n", __func__); | LogPrintf("Shutdown requested. Exit %s\n", __func__); | ||||
return; | return; | ||||
} | } | ||||
} else { | } else { | ||||
LogPrintf("Warning: Could not open blocks file %s\n", | LogPrintf("Warning: Could not open blocks file %s\n", | ||||
fs::PathToString(path)); | fs::PathToString(path)); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 47 Lines • Show Last 20 Lines |