mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-15 12:51:00 +02:00
Move external block import to separate thread
This commit is contained in:
parent
485d667748
commit
66b02c93e6
7 changed files with 70 additions and 27 deletions
22
src/init.cpp
22
src/init.cpp
|
|
@ -776,29 +776,13 @@ bool AppInit2()
|
|||
|
||||
// ********************************************************* Step 9: import blocks
|
||||
|
||||
std::vector<boost::filesystem::path> *vPath = new std::vector<boost::filesystem::path>();
|
||||
if (mapArgs.count("-loadblock"))
|
||||
{
|
||||
uiInterface.InitMessage(_("Importing blockchain data file."));
|
||||
|
||||
BOOST_FOREACH(string strFile, mapMultiArgs["-loadblock"])
|
||||
{
|
||||
FILE *file = fopen(strFile.c_str(), "rb");
|
||||
if (file)
|
||||
LoadExternalBlockFile(file);
|
||||
}
|
||||
}
|
||||
|
||||
filesystem::path pathBootstrap = GetDataDir() / "bootstrap.dat";
|
||||
if (filesystem::exists(pathBootstrap)) {
|
||||
uiInterface.InitMessage(_("Importing bootstrap blockchain data file."));
|
||||
|
||||
FILE *file = fopen(pathBootstrap.string().c_str(), "rb");
|
||||
if (file) {
|
||||
filesystem::path pathBootstrapOld = GetDataDir() / "bootstrap.dat.old";
|
||||
LoadExternalBlockFile(file);
|
||||
RenameOver(pathBootstrap, pathBootstrapOld);
|
||||
}
|
||||
vPath->push_back(strFile);
|
||||
}
|
||||
NewThread(ThreadImport, vPath);
|
||||
|
||||
// ********************************************************* Step 10: load peers
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue