Merge bitcoin/bitcoin#27708: Return EXIT_FAILURE on post-init fatal errors
61c569ab60refactor: decouple early return commands from AppInit (furszy)4927167f85gui: return EXIT_FAILURE on post-init fatal errors (furszy)3b2c61e819Return EXIT_FAILURE on post-init fatal errors (furszy)3c06926cf2refactor: index: use `AbortNode` in fatal error helper (Sebastian Falbesoner)9ddf7e03a3move ThreadImport ABC error to use AbortNode (furszy) Pull request description: It seems odd to return `EXIT_SUCCESS` when the node aborted execution due a fatal internal error or any post-init problem that triggers an unrequested shutdown. e.g. blocks or coins db I/O errors, disconnect block failure, failure during thread import (external blocks loading process error), among others. ACKs for top commit: TheCharlatan: ACK61c569ab60ryanofsky: Code review ACK61c569ab60pinheadmz: ACK61c569ab60theStack: Code-review ACK61c569ab60Tree-SHA512: 18a59c3acc1c6d12cbc74a20a401e89659740c6477fccb59070c9f97922dfe588468e9e5eef56c5f395762187c34179a5e3954aa5b844787fa13da2e666c63d3
This commit is contained in:
14 files changed
+85
-56
No files matched your search
+4
-7
@@ -9,6 +9,7 @@
|
||||
#include <qt/bitcoin.h>
|
||||
|
||||
#include <chainparams.h>
|
||||
#include <node/context.h>
|
||||
#include <common/args.h>
|
||||
#include <common/init.h>
|
||||
#include <common/system.h>
|
||||
@@ -397,9 +398,7 @@ void BitcoinApplication::initializeResult(bool success, interfaces::BlockAndHead
|
||||
{
|
||||
qDebug() << __func__ << ": Initialization result: " << success;
|
||||
|
||||
// Set exit result.
|
||||
returnValue = success ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
if(success) {
|
||||
if (success) {
|
||||
delete m_splash;
|
||||
m_splash = nullptr;
|
||||
|
||||
@@ -653,7 +652,6 @@ int GuiMain(int argc, char* argv[])
|
||||
app.InitPruneSetting(prune_MiB);
|
||||
}
|
||||
|
||||
int rv = EXIT_SUCCESS;
|
||||
try
|
||||
{
|
||||
app.createWindow(networkStyle.data());
|
||||
@@ -666,10 +664,9 @@ int GuiMain(int argc, char* argv[])
|
||||
WinShutdownMonitor::registerShutdownBlockReason(QObject::tr("%1 didn't yet exit safely…").arg(PACKAGE_NAME), (HWND)app.getMainWinId());
|
||||
#endif
|
||||
app.exec();
|
||||
rv = app.getReturnValue();
|
||||
} else {
|
||||
// A dialog with detailed error will have been shown by InitError()
|
||||
rv = EXIT_FAILURE;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
} catch (const std::exception& e) {
|
||||
PrintExceptionContinue(&e, "Runaway exception");
|
||||
@@ -678,5 +675,5 @@ int GuiMain(int argc, char* argv[])
|
||||
PrintExceptionContinue(nullptr, "Runaway exception");
|
||||
app.handleRunawayException(QString::fromStdString(app.node().getWarnings().translated));
|
||||
}
|
||||
return rv;
|
||||
return app.node().getExitStatus();
|
||||
}
|
||||
@@ -62,9 +62,6 @@ public:
|
||||
/// Request core initialization
|
||||
void requestInitialize();
|
||||
|
||||
/// Get process return value
|
||||
int getReturnValue() const { return returnValue; }
|
||||
|
||||
/// Get window identifier of QMainWindow (BitcoinGUI)
|
||||
WId getMainWinId() const;
|
||||
|
||||
@@ -104,7 +101,6 @@ private:
|
||||
PaymentServer* paymentServer{nullptr};
|
||||
WalletController* m_wallet_controller{nullptr};
|
||||
#endif
|
||||
int returnValue{0};
|
||||
const PlatformStyle* platformStyle{nullptr};
|
||||
std::unique_ptr<QWidget> shutdownWindow;
|
||||
SplashScreen* m_splash = nullptr;
|
||||
|
||||
Reference in new issue
Block a user