|
|
@ -313,12 +313,12 @@ void ThreadImport(std::vector<boost::filesystem::path> vImportFiles) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// hardcoded $DATADIR/bootstrap.dat
|
|
|
|
// hardcoded $DATADIR/bootstrap.dat
|
|
|
|
filesystem::path pathBootstrap = GetDataDir() / "bootstrap.dat"; |
|
|
|
boost::filesystem::path pathBootstrap = GetDataDir() / "bootstrap.dat"; |
|
|
|
if (filesystem::exists(pathBootstrap)) { |
|
|
|
if (boost::filesystem::exists(pathBootstrap)) { |
|
|
|
FILE *file = fopen(pathBootstrap.string().c_str(), "rb"); |
|
|
|
FILE *file = fopen(pathBootstrap.string().c_str(), "rb"); |
|
|
|
if (file) { |
|
|
|
if (file) { |
|
|
|
CImportingNow imp; |
|
|
|
CImportingNow imp; |
|
|
|
filesystem::path pathBootstrapOld = GetDataDir() / "bootstrap.dat.old"; |
|
|
|
boost::filesystem::path pathBootstrapOld = GetDataDir() / "bootstrap.dat.old"; |
|
|
|
printf("Importing bootstrap.dat...\n"); |
|
|
|
printf("Importing bootstrap.dat...\n"); |
|
|
|
LoadExternalBlockFile(file); |
|
|
|
LoadExternalBlockFile(file); |
|
|
|
RenameOver(pathBootstrap, pathBootstrapOld); |
|
|
|
RenameOver(pathBootstrap, pathBootstrapOld); |
|
|
@ -571,7 +571,7 @@ bool AppInit2(boost::thread_group& threadGroup) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (filesystem::exists(GetDataDir() / "twisterwallet.dat")) |
|
|
|
if (boost::filesystem::exists(GetDataDir() / "twisterwallet.dat")) |
|
|
|
{ |
|
|
|
{ |
|
|
|
CDBEnv::VerifyResult r = bitdb.Verify("twisterwallet.dat", CWalletDB::Recover); |
|
|
|
CDBEnv::VerifyResult r = bitdb.Verify("twisterwallet.dat", CWalletDB::Recover); |
|
|
|
if (r == CDBEnv::RECOVER_OK) |
|
|
|
if (r == CDBEnv::RECOVER_OK) |
|
|
@ -700,20 +700,20 @@ bool AppInit2(boost::thread_group& threadGroup) |
|
|
|
fReindex = GetBoolArg("-reindex", false); |
|
|
|
fReindex = GetBoolArg("-reindex", false); |
|
|
|
|
|
|
|
|
|
|
|
// Upgrading to 0.8; hard-link the old blknnnn.dat files into /blocks/
|
|
|
|
// Upgrading to 0.8; hard-link the old blknnnn.dat files into /blocks/
|
|
|
|
filesystem::path blocksDir = GetDataDir() / "blocks"; |
|
|
|
boost::filesystem::path blocksDir = GetDataDir() / "blocks"; |
|
|
|
if (!filesystem::exists(blocksDir)) |
|
|
|
if (!boost::filesystem::exists(blocksDir)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
filesystem::create_directories(blocksDir); |
|
|
|
boost::filesystem::create_directories(blocksDir); |
|
|
|
bool linked = false; |
|
|
|
bool linked = false; |
|
|
|
for (unsigned int i = 1; i < 10000; i++) { |
|
|
|
for (unsigned int i = 1; i < 10000; i++) { |
|
|
|
filesystem::path source = GetDataDir() / strprintf("blk%04u.dat", i); |
|
|
|
boost::filesystem::path source = GetDataDir() / strprintf("blk%04u.dat", i); |
|
|
|
if (!filesystem::exists(source)) break; |
|
|
|
if (!boost::filesystem::exists(source)) break; |
|
|
|
filesystem::path dest = blocksDir / strprintf("blk%05u.dat", i-1); |
|
|
|
boost::filesystem::path dest = blocksDir / strprintf("blk%05u.dat", i-1); |
|
|
|
try { |
|
|
|
try { |
|
|
|
filesystem::create_hard_link(source, dest); |
|
|
|
boost::filesystem::create_hard_link(source, dest); |
|
|
|
printf("Hardlinked %s -> %s\n", source.string().c_str(), dest.string().c_str()); |
|
|
|
printf("Hardlinked %s -> %s\n", source.string().c_str(), dest.string().c_str()); |
|
|
|
linked = true; |
|
|
|
linked = true; |
|
|
|
} catch (filesystem::filesystem_error & e) { |
|
|
|
} catch (boost::filesystem::filesystem_error & e) { |
|
|
|
// Note: hardlink creation failing is not a disaster, it just means
|
|
|
|
// Note: hardlink creation failing is not a disaster, it just means
|
|
|
|
// blocks will get re-downloaded from peers.
|
|
|
|
// blocks will get re-downloaded from peers.
|
|
|
|
printf("Error hardlinking blk%04u.dat : %s\n", i, e.what()); |
|
|
|
printf("Error hardlinking blk%04u.dat : %s\n", i, e.what()); |
|
|
|