init: Remove boost from ThreadImport
This commit is contained in:
parent
ae32e5ce3d
commit
faec3dc2ad
3 changed files with 12 additions and 6 deletions
|
@ -708,6 +708,10 @@ static void ThreadImport(std::vector<fs::path> vImportFiles)
|
||||||
break; // This error is logged in OpenBlockFile
|
break; // This error is logged in OpenBlockFile
|
||||||
LogPrintf("Reindexing block file blk%05u.dat...\n", (unsigned int)nFile);
|
LogPrintf("Reindexing block file blk%05u.dat...\n", (unsigned int)nFile);
|
||||||
LoadExternalBlockFile(chainparams, file, &pos);
|
LoadExternalBlockFile(chainparams, file, &pos);
|
||||||
|
if (ShutdownRequested()) {
|
||||||
|
LogPrintf("Shutdown requested. Exit %s\n", __func__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
nFile++;
|
nFile++;
|
||||||
}
|
}
|
||||||
pblocktree->WriteReindexing(false);
|
pblocktree->WriteReindexing(false);
|
||||||
|
@ -723,6 +727,10 @@ static void ThreadImport(std::vector<fs::path> vImportFiles)
|
||||||
if (file) {
|
if (file) {
|
||||||
LogPrintf("Importing blocks file %s...\n", path.string());
|
LogPrintf("Importing blocks file %s...\n", path.string());
|
||||||
LoadExternalBlockFile(chainparams, file);
|
LoadExternalBlockFile(chainparams, file);
|
||||||
|
if (ShutdownRequested()) {
|
||||||
|
LogPrintf("Shutdown requested. Exit %s\n", __func__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
LogPrintf("Warning: Could not open blocks file %s\n", path.string());
|
LogPrintf("Warning: Could not open blocks file %s\n", path.string());
|
||||||
}
|
}
|
||||||
|
|
|
@ -4637,7 +4637,7 @@ bool LoadGenesisBlock(const CChainParams& chainparams)
|
||||||
return ::ChainstateActive().LoadGenesisBlock(chainparams);
|
return ::ChainstateActive().LoadGenesisBlock(chainparams);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LoadExternalBlockFile(const CChainParams& chainparams, FILE* fileIn, FlatFilePos *dbp)
|
void LoadExternalBlockFile(const CChainParams& chainparams, FILE* fileIn, FlatFilePos* dbp)
|
||||||
{
|
{
|
||||||
// Map of disk positions for blocks with unknown parent (only used for reindex)
|
// Map of disk positions for blocks with unknown parent (only used for reindex)
|
||||||
static std::multimap<uint256, FlatFilePos> mapBlocksUnknownParent;
|
static std::multimap<uint256, FlatFilePos> mapBlocksUnknownParent;
|
||||||
|
@ -4649,7 +4649,7 @@ bool LoadExternalBlockFile(const CChainParams& chainparams, FILE* fileIn, FlatFi
|
||||||
CBufferedFile blkdat(fileIn, 2*MAX_BLOCK_SERIALIZED_SIZE, MAX_BLOCK_SERIALIZED_SIZE+8, SER_DISK, CLIENT_VERSION);
|
CBufferedFile blkdat(fileIn, 2*MAX_BLOCK_SERIALIZED_SIZE, MAX_BLOCK_SERIALIZED_SIZE+8, SER_DISK, CLIENT_VERSION);
|
||||||
uint64_t nRewind = blkdat.GetPos();
|
uint64_t nRewind = blkdat.GetPos();
|
||||||
while (!blkdat.eof()) {
|
while (!blkdat.eof()) {
|
||||||
boost::this_thread::interruption_point();
|
if (ShutdownRequested()) return;
|
||||||
|
|
||||||
blkdat.SetPos(nRewind);
|
blkdat.SetPos(nRewind);
|
||||||
nRewind++; // start one byte further next time, in case of failure
|
nRewind++; // start one byte further next time, in case of failure
|
||||||
|
@ -4754,9 +4754,7 @@ bool LoadExternalBlockFile(const CChainParams& chainparams, FILE* fileIn, FlatFi
|
||||||
} catch (const std::runtime_error& e) {
|
} catch (const std::runtime_error& e) {
|
||||||
AbortNode(std::string("System error: ") + e.what());
|
AbortNode(std::string("System error: ") + e.what());
|
||||||
}
|
}
|
||||||
if (nLoaded > 0)
|
|
||||||
LogPrintf("Loaded %i blocks from external file in %dms\n", nLoaded, GetTimeMillis() - nStart);
|
LogPrintf("Loaded %i blocks from external file in %dms\n", nLoaded, GetTimeMillis() - nStart);
|
||||||
return nLoaded > 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CChainState::CheckBlockIndex(const Consensus::Params& consensusParams)
|
void CChainState::CheckBlockIndex(const Consensus::Params& consensusParams)
|
||||||
|
|
|
@ -180,7 +180,7 @@ FILE* OpenBlockFile(const FlatFilePos &pos, bool fReadOnly = false);
|
||||||
/** Translation to a filesystem path */
|
/** Translation to a filesystem path */
|
||||||
fs::path GetBlockPosFilename(const FlatFilePos &pos);
|
fs::path GetBlockPosFilename(const FlatFilePos &pos);
|
||||||
/** Import blocks from an external file */
|
/** Import blocks from an external file */
|
||||||
bool LoadExternalBlockFile(const CChainParams& chainparams, FILE* fileIn, FlatFilePos *dbp = nullptr);
|
void LoadExternalBlockFile(const CChainParams& chainparams, FILE* fileIn, FlatFilePos* dbp = nullptr);
|
||||||
/** Ensures we have a genesis block in the block tree, possibly writing one to disk. */
|
/** Ensures we have a genesis block in the block tree, possibly writing one to disk. */
|
||||||
bool LoadGenesisBlock(const CChainParams& chainparams);
|
bool LoadGenesisBlock(const CChainParams& chainparams);
|
||||||
/** Load the block tree and coins database from disk,
|
/** Load the block tree and coins database from disk,
|
||||||
|
|
Loading…
Reference in a new issue