-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Backport 14734, 15457, 16344, 16352, 16366 #4532
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3daeb28
56251ec
79e5eb8
6d6b585
fe14f50
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,21 +12,20 @@ | |
| #include <clientversion.h> | ||
| #include <compat.h> | ||
| #include <fs.h> | ||
| #include <interfaces/chain.h> | ||
| #include <rpc/server.h> | ||
| #include <init.h> | ||
| #include <interfaces/chain.h> | ||
| #include <noui.h> | ||
| #include <shutdown.h> | ||
| #include <ui_interface.h> | ||
| #include <util/strencodings.h> | ||
| #include <util/system.h> | ||
| #include <httpserver.h> | ||
| #include <httprpc.h> | ||
| #include <util/strencodings.h> | ||
| #include <util/threadnames.h> | ||
| #include <walletinitinterface.h> | ||
| #include <stacktraces.h> | ||
|
|
||
| #include <stdio.h> | ||
|
|
||
| const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr; | ||
|
|
||
| /* Introduction text for doxygen: */ | ||
|
|
@@ -74,8 +73,7 @@ static bool AppInit(int argc, char* argv[]) | |
| SetupServerArgs(); | ||
| std::string error; | ||
| if (!gArgs.ParseParameters(argc, argv, error)) { | ||
| fprintf(stderr, "Error parsing command line arguments: %s\n", error.c_str()); | ||
| return false; | ||
| return InitError(strprintf("Error parsing command line arguments: %s\n", error)); | ||
| } | ||
|
|
||
| if (gArgs.IsArgSet("-printcrashinfo")) { | ||
|
|
@@ -106,12 +104,10 @@ static bool AppInit(int argc, char* argv[]) | |
| bool datadirFromCmdLine = gArgs.IsArgSet("-datadir"); | ||
| if (datadirFromCmdLine && !fs::is_directory(GetDataDir(false))) | ||
| { | ||
| fprintf(stderr, "Error: Specified data directory \"%s\" does not exist.\n", gArgs.GetArg("-datadir", "").c_str()); | ||
| return false; | ||
| return InitError(strprintf("Specified data directory \"%s\" does not exist.\n", gArgs.GetArg("-datadir", ""))); | ||
| } | ||
| if (!gArgs.ReadConfigFiles(error, true)) { | ||
| fprintf(stderr, "Error reading configuration file: %s\n", error.c_str()); | ||
| return false; | ||
| return InitError(strprintf("Error reading configuration file: %s\n", error)); | ||
| } | ||
| if (!datadirFromCmdLine && !fs::is_directory(GetDataDir(false))) | ||
| { | ||
|
|
@@ -122,15 +118,13 @@ static bool AppInit(int argc, char* argv[]) | |
| try { | ||
| SelectParams(gArgs.GetChainName()); | ||
| } catch (const std::exception& e) { | ||
| fprintf(stderr, "Error: %s\n", e.what()); | ||
| return false; | ||
| return InitError(strprintf("%s\n", e.what())); | ||
| } | ||
|
|
||
| // Error out when loose non-argument tokens are encountered on command line | ||
| for (int i = 1; i < argc; i++) { | ||
| if (!IsSwitchChar(argv[i][0])) { | ||
| fprintf(stderr, "Error: Command line contains unexpected token '%s', see dashd -h for a list of options.\n", argv[i]); | ||
| return false; | ||
| return InitError(strprintf("Command line contains unexpected token '%s', see bitcoind -h for a list of options.\n", argv[i])); | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -161,19 +155,17 @@ static bool AppInit(int argc, char* argv[]) | |
| #pragma GCC diagnostic push | ||
| #pragma GCC diagnostic ignored "-Wdeprecated-declarations" | ||
| #endif | ||
| fprintf(stdout, "Dash Core server starting\n"); | ||
| tfm::format(std::cout, PACKAGE_NAME "daemon starting\n"); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 16366: should keep |
||
|
|
||
| // Daemonize | ||
| if (daemon(1, 0)) { // don't chdir (1), do close FDs (0) | ||
| fprintf(stderr, "Error: daemon() failed: %s\n", strerror(errno)); | ||
| return false; | ||
| return InitError(strprintf("daemon() failed: %s\n", strerror(errno))); | ||
| } | ||
| #if defined(MAC_OSX) | ||
| #pragma GCC diagnostic pop | ||
| #endif | ||
| #else | ||
| fprintf(stderr, "Error: -daemon is not supported on this operating system\n"); | ||
| return false; | ||
| return InitError("-daemon is not supported on this operating system\n"); | ||
| #endif // HAVE_DECL_DAEMON | ||
| } | ||
| // Lock data directory after daemonization | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,8 +11,8 @@ | |
| #include <qt/bitcoingui.h> | ||
|
|
||
| #include <chainparams.h> | ||
| #include <qt/clientmodel.h> | ||
| #include <fs.h> | ||
| #include <qt/clientmodel.h> | ||
| #include <qt/guiconstants.h> | ||
| #include <qt/guiutil.h> | ||
| #include <qt/intro.h> | ||
|
|
@@ -41,9 +41,6 @@ | |
| #include <walletinitinterface.h> | ||
|
|
||
| #include <memory> | ||
| #include <stdint.h> | ||
|
|
||
| #include <boost/thread.hpp> | ||
|
|
||
| #include <QApplication> | ||
| #include <QDebug> | ||
|
|
@@ -486,8 +483,11 @@ int GuiMain(int argc, char* argv[]) | |
| SetupUIArgs(); | ||
| std::string error; | ||
| if (!node->parseParameters(argc, argv, error)) { | ||
| node->initError(strprintf("Error parsing command line arguments: %s\n", error)); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 16366: should probably apply it near |
||
| // Create a message box, because the gui has neither been created nor has subscribed to core signals | ||
| QMessageBox::critical(nullptr, QObject::tr(PACKAGE_NAME), | ||
| QObject::tr("Error parsing command line arguments: %1.").arg(QString::fromStdString(error))); | ||
| // message can not be translated because translations have not been initialized | ||
| QString::fromStdString("Error parsing command line arguments: %1.").arg(QString::fromStdString(error))); | ||
| return EXIT_FAILURE; | ||
| } | ||
|
|
||
|
|
@@ -530,11 +530,13 @@ int GuiMain(int argc, char* argv[]) | |
| /// - Do not call GetDataDir(true) before this step finishes | ||
| if (!fs::is_directory(GetDataDir(false))) | ||
| { | ||
| node->initError(strprintf("Specified data directory \"%s\" does not exist.\n", gArgs.GetArg("-datadir", ""))); | ||
| QMessageBox::critical(nullptr, QObject::tr(PACKAGE_NAME), | ||
| QObject::tr("Error: Specified data directory \"%1\" does not exist.").arg(QString::fromStdString(gArgs.GetArg("-datadir", "")))); | ||
| return EXIT_FAILURE; | ||
| } | ||
| if (!node->readConfigFiles(error)) { | ||
| node->initError(strprintf("Error reading configuration file: %s\n", error)); | ||
| QMessageBox::critical(nullptr, QObject::tr(PACKAGE_NAME), | ||
| QObject::tr("Error: Cannot parse configuration file: %1.").arg(QString::fromStdString(error))); | ||
| return EXIT_FAILURE; | ||
|
|
@@ -550,6 +552,7 @@ int GuiMain(int argc, char* argv[]) | |
| try { | ||
| node->selectParams(gArgs.GetChainName()); | ||
| } catch(std::exception &e) { | ||
| node->initError(strprintf("%s\n", e.what())); | ||
| QMessageBox::critical(nullptr, QObject::tr(PACKAGE_NAME), QObject::tr("Error: %1").arg(e.what())); | ||
| return EXIT_FAILURE; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,7 +11,6 @@ | |
|
|
||
| #include <QApplication> | ||
| #include <memory> | ||
| #include <vector> | ||
|
|
||
| class BitcoinGUI; | ||
| class ClientModel; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
16366: should apply it below too, line 114