|
|
@ -59,31 +59,14 @@ bool AppInit(int argc, char* argv[]) |
|
|
|
boost::thread* detectShutdownThread = NULL; |
|
|
|
boost::thread* detectShutdownThread = NULL; |
|
|
|
|
|
|
|
|
|
|
|
bool fRet = false; |
|
|
|
bool fRet = false; |
|
|
|
try |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Parameters
|
|
|
|
// Parameters
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// If Qt is used, parameters/bitcoin.conf are parsed in qt/bitcoin.cpp's main()
|
|
|
|
// If Qt is used, parameters/bitcoin.conf are parsed in qt/bitcoin.cpp's main()
|
|
|
|
ParseParameters(argc, argv); |
|
|
|
ParseParameters(argc, argv); |
|
|
|
if (!boost::filesystem::is_directory(GetDataDir(false))) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
fprintf(stderr, "Error: Specified data directory \"%s\" does not exist.\n", mapArgs["-datadir"].c_str()); |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
try |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ReadConfigFile(mapArgs, mapMultiArgs); |
|
|
|
|
|
|
|
} catch(std::exception &e) { |
|
|
|
|
|
|
|
fprintf(stderr,"Error reading configuration file: %s\n", e.what()); |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// Check for -testnet or -regtest parameter (Params() calls are only valid after this clause)
|
|
|
|
|
|
|
|
if (!SelectParamsFromCommandLine()) { |
|
|
|
|
|
|
|
fprintf(stderr, "Error: Invalid combination of -regtest and -testnet.\n"); |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Process help and version before taking care about datadir
|
|
|
|
if (mapArgs.count("-?") || mapArgs.count("-help") || mapArgs.count("-version")) |
|
|
|
if (mapArgs.count("-?") || mapArgs.count("-help") || mapArgs.count("-version")) |
|
|
|
{ |
|
|
|
{ |
|
|
|
std::string strUsage = _("Bitcoin Core Daemon") + " " + _("version") + " " + FormatFullVersion() + "\n"; |
|
|
|
std::string strUsage = _("Bitcoin Core Daemon") + " " + _("version") + " " + FormatFullVersion() + "\n"; |
|
|
@ -104,6 +87,26 @@ bool AppInit(int argc, char* argv[]) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (!boost::filesystem::is_directory(GetDataDir(false))) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
fprintf(stderr, "Error: Specified data directory \"%s\" does not exist.\n", mapArgs["-datadir"].c_str()); |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
try |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ReadConfigFile(mapArgs, mapMultiArgs); |
|
|
|
|
|
|
|
} catch(std::exception &e) { |
|
|
|
|
|
|
|
fprintf(stderr,"Error reading configuration file: %s\n", e.what()); |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// Check for -testnet or -regtest parameter (Params() calls are only valid after this clause)
|
|
|
|
|
|
|
|
if (!SelectParamsFromCommandLine()) { |
|
|
|
|
|
|
|
fprintf(stderr, "Error: Invalid combination of -regtest and -testnet.\n"); |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Command-line RPC
|
|
|
|
// Command-line RPC
|
|
|
|
bool fCommandLine = false; |
|
|
|
bool fCommandLine = false; |
|
|
|
for (int i = 1; i < argc; i++) |
|
|
|
for (int i = 1; i < argc; i++) |
|
|
|