From 0629f0615636458b97a0b526014b129b143e99dc Mon Sep 17 00:00:00 2001 From: xiphon Date: Tue, 4 Feb 2020 23:27:48 +0000 Subject: [PATCH] DaemonManager: check monerod binary, error details on start failure --- main.qml | 4 ++-- src/daemon/DaemonManager.cpp | 10 ++++++++-- src/daemon/DaemonManager.h | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/main.qml b/main.qml index efe8b740..4bbd43cc 100644 --- a/main.qml +++ b/main.qml @@ -708,14 +708,14 @@ ApplicationWindow { currentWallet.connected(true); } - function onDaemonStartFailure(){ + function onDaemonStartFailure(error) { console.log("daemon start failed"); hideProcessingSplash(); // resume refresh currentWallet.startRefresh(); daemonRunning = false; informationPopup.title = qsTr("Daemon failed to start") + translationManager.emptyString; - informationPopup.text = qsTr("Please check your wallet and daemon log for errors. You can also try to start %1 manually.").arg((isWindows)? "monerod.exe" : "monerod") + informationPopup.text = error + ".\n\n" + qsTr("Please check your wallet and daemon log for errors. You can also try to start %1 manually.").arg((isWindows)? "monerod.exe" : "monerod") informationPopup.icon = StandardIcon.Critical informationPopup.onCloseCallback = null informationPopup.open(); diff --git a/src/daemon/DaemonManager.cpp b/src/daemon/DaemonManager.cpp index 74da6351..8d995458 100644 --- a/src/daemon/DaemonManager.cpp +++ b/src/daemon/DaemonManager.cpp @@ -63,6 +63,12 @@ DaemonManager *DaemonManager::instance(const QStringList *args) bool DaemonManager::start(const QString &flags, NetworkType::Type nettype, const QString &dataDir, const QString &bootstrapNodeAddress, bool noSync /* = false*/) { + if (!QFileInfo(m_monerod).isFile()) + { + emit daemonStartFailure("\"" + QDir::toNativeSeparators(m_monerod) + "\" " + tr("executable is missing")); + return false; + } + // prepare command line arguments and pass to monerod QStringList arguments; @@ -130,7 +136,7 @@ bool DaemonManager::start(const QString &flags, NetworkType::Type nettype, const if (!started) { qDebug() << "Daemon start error: " + m_daemon->errorString(); - emit daemonStartFailure(); + emit daemonStartFailure(m_daemon->errorString()); return false; } @@ -140,7 +146,7 @@ bool DaemonManager::start(const QString &flags, NetworkType::Type nettype, const emit daemonStarted(); m_noSync = noSync; } else { - emit daemonStartFailure(); + emit daemonStartFailure(tr("Timed out, local node is not responding after %1 seconds").arg(DAEMON_START_TIMEOUT_SECONDS)); } }); diff --git a/src/daemon/DaemonManager.h b/src/daemon/DaemonManager.h index a03d3d9b..4bbd3133 100644 --- a/src/daemon/DaemonManager.h +++ b/src/daemon/DaemonManager.h @@ -64,7 +64,7 @@ private: signals: void daemonStarted() const; void daemonStopped() const; - void daemonStartFailure() const; + void daemonStartFailure(const QString &error) const; void daemonConsoleUpdated(QString message) const; public slots: