From 52c90a2b2b8d5628224e66be2dc2974c94e39fd9 Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Mon, 24 Sep 2012 13:37:03 -0400 Subject: [PATCH] Import $DataDir/bootstrap.dat automatically, if it exists. As discussed on IRC. Intended to make using an external blockchain download solution just a bit easier. --- src/init.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/init.cpp b/src/init.cpp index dc425da6..4df12af8 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..."));