aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@exmulti.com>2012-09-25 13:53:40 -0700
committerJeff Garzik <jgarzik@exmulti.com>2012-09-25 13:53:40 -0700
commit1381ad2b21733071acb2a43c251dbecef524f110 (patch)
treef004fb94e8a7fdafb3542af34dbc5baa3a87aff7
parent4d369ec30c18fc7669c73bad7178303e25ea25f0 (diff)
parent52c90a2b2b8d5628224e66be2dc2974c94e39fd9 (diff)
Merge pull request #1684 from jgarzik/bootstrap
Import $DataDir/bootstrap.dat automatically, if it exists.
-rw-r--r--src/init.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/init.cpp b/src/init.cpp
index dc425da644..4df12af84c 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -722,7 +722,8 @@ bool AppInit2()
if (mapArgs.count("-loadblock"))
{
- uiInterface.InitMessage(_("Importing blocks..."));
+ uiInterface.InitMessage(_("Importing blockchain data file."));
+
BOOST_FOREACH(string strFile, mapMultiArgs["-loadblock"])
{
FILE *file = fopen(strFile.c_str(), "rb");
@@ -731,6 +732,18 @@ bool AppInit2()
}
}
+ 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);
+ }
+ }
+
// ********************************************************* Step 9: load peers
uiInterface.InitMessage(_("Loading addresses..."));