diff options
Diffstat (limited to 'src/init.cpp')
| -rw-r--r-- | src/init.cpp | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/src/init.cpp b/src/init.cpp index 0eb37fe99..b89c9edf8 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -150,11 +150,12 @@ bool AppInit2(int argc, char* argv[]) // If Qt is used, parameters/bitcoin.conf are parsed in qt/bitcoin.cpp's main() #if !defined(QT_GUI) ParseParameters(argc, argv); - if (!ReadConfigFile(mapArgs, mapMultiArgs)) + if (!boost::filesystem::is_directory(GetDataDir(false))) { fprintf(stderr, "Error: Specified directory does not exist\n"); Shutdown(NULL); } + ReadConfigFile(mapArgs, mapMultiArgs); #endif if (mapArgs.count("-?") || mapArgs.count("--help")) @@ -199,6 +200,7 @@ bool AppInit2(int argc, char* argv[]) #else " -upnp \t " + _("Use Universal Plug and Play to map the listening port (default: 0)") + "\n" + #endif + " -detachdb \t " + _("Detach block and address databases. Increases shutdown time (default: 0)") + "\n" + #endif " -paytxfee=<amt> \t " + _("Fee per KB to add to transactions you send") + "\n" + #ifdef QT_GUI @@ -224,7 +226,8 @@ bool AppInit2(int argc, char* argv[]) " -keypool=<n> \t " + _("Set key pool size to <n> (default: 100)") + "\n" + " -rescan \t " + _("Rescan the block chain for missing wallet transactions") + "\n" + " -checkblocks=<n> \t\t " + _("How many blocks to check at startup (default: 2500, 0 = all)") + "\n" + - " -checklevel=<n> \t\t " + _("How thorough the block verification is (0-6, default: 1)") + "\n"; + " -checklevel=<n> \t\t " + _("How thorough the block verification is (0-6, default: 1)") + "\n" + + " -loadblock=<file>\t " + _("Imports blocks from external blk000?.dat file") + "\n"; strUsage += string() + _("\nSSL options: (see the Bitcoin Wiki for SSL setup instructions)") + "\n" + @@ -254,6 +257,7 @@ bool AppInit2(int argc, char* argv[]) } fDebug = GetBoolArg("-debug"); + fDetachDB = GetBoolArg("-detachdb", false); #if !defined(WIN32) && !defined(QT_GUI) fDaemon = GetBoolArg("-daemon"); @@ -353,8 +357,27 @@ bool AppInit2(int argc, char* argv[]) nStart = GetTimeMillis(); if (!LoadBlockIndex()) strErrors << _("Error loading blkindex.dat") << "\n"; + + // as LoadBlockIndex can take several minutes, it's possible the user + // requested to kill bitcoin-qt during the last operation. If so, exit. + // As the program has not fully started yet, Shutdown() is possibly overkill. + if (fRequestShutdown) + { + printf("Shutdown requested. Exiting.\n"); + return false; + } printf(" block index %15"PRI64d"ms\n", GetTimeMillis() - nStart); + if (mapArgs.count("-loadblock")) + { + BOOST_FOREACH(string strFile, mapMultiArgs["-loadblock"]) + { + FILE *file = fopen(strFile.c_str(), "rb"); + if (file) + LoadExternalBlockFile(file); + } + } + InitMessage(_("Loading wallet...")); printf("Loading wallet...\n"); nStart = GetTimeMillis(); @@ -572,8 +595,8 @@ bool AppInit2(int argc, char* argv[]) CreateThread(ThreadRPCServer, NULL); #ifdef QT_GUI - if(GetStartOnSystemStartup()) - SetStartOnSystemStartup(true); // Remove startup links to bitcoin-wx + if (GetStartOnSystemStartup()) + SetStartOnSystemStartup(true); // Remove startup links #endif #if !defined(QT_GUI) |