diff options
author | furszy <matiasfurszyfer@protonmail.com> | 2023-05-20 10:51:17 -0300 |
---|---|---|
committer | furszy <matiasfurszyfer@protonmail.com> | 2023-06-09 17:52:23 -0300 |
commit | 3b2c61e8198bcefb1c2343caff1d705951026cc4 (patch) | |
tree | c4ad99b748548d76a15ffaf32d9dad44c774e1ec /src/bitcoind.cpp | |
parent | 3c06926cf21dcca3074ef51506f556b2286c299b (diff) | |
download | bitcoin-3b2c61e8198bcefb1c2343caff1d705951026cc4.tar.xz |
Return EXIT_FAILURE on post-init fatal errors
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.
Co-authored-by: Ryan Ofsky <ryan@ofsky.org>
Diffstat (limited to 'src/bitcoind.cpp')
-rw-r--r-- | src/bitcoind.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp index aefb130e9c..8982d0a316 100644 --- a/src/bitcoind.cpp +++ b/src/bitcoind.cpp @@ -169,7 +169,7 @@ static bool AppInit(NodeContext& node, int argc, char* argv[]) // Set this early so that parameter interactions go to console InitLogging(args); InitParameterInteraction(args); - if (!AppInitBasicSetup(args)) { + if (!AppInitBasicSetup(args, node.exit_status)) { // InitError will have been called with detailed error, which ends up on console return false; } @@ -238,6 +238,8 @@ static bool AppInit(NodeContext& node, int argc, char* argv[]) SetSyscallSandboxPolicy(SyscallSandboxPolicy::SHUTOFF); if (fRet) { WaitForShutdown(); + } else { + node.exit_status = EXIT_FAILURE; } Interrupt(node); Shutdown(node); @@ -264,5 +266,5 @@ MAIN_FUNCTION // Connect bitcoind signal handlers noui_connect(); - return (AppInit(node, argc, argv) ? EXIT_SUCCESS : EXIT_FAILURE); + return AppInit(node, argc, argv) ? node.exit_status.load() : EXIT_FAILURE; } |