mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 22:18:54 +01:00
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:
@@ -89,10 +89,11 @@ public:
|
||||
void initLogging() override { InitLogging(args()); }
|
||||
void initParameterInteraction() override { InitParameterInteraction(args()); }
|
||||
bilingual_str getWarnings() override { return GetWarnings(true); }
|
||||
int getExitStatus() override { return Assert(m_context)->exit_status.load(); }
|
||||
uint32_t getLogCategories() override { return LogInstance().GetCategoryMask(); }
|
||||
bool baseInitialize() override
|
||||
{
|
||||
if (!AppInitBasicSetup(args())) return false;
|
||||
if (!AppInitBasicSetup(args(), Assert(context())->exit_status)) return false;
|
||||
if (!AppInitParameterInteraction(args(), /*use_syscall_sandbox=*/false)) return false;
|
||||
|
||||
m_context->kernel = std::make_unique<kernel::Context>();
|
||||
@@ -105,7 +106,10 @@ public:
|
||||
}
|
||||
bool appInitMain(interfaces::BlockAndHeaderTipInfo* tip_info) override
|
||||
{
|
||||
return AppInitMain(*m_context, tip_info);
|
||||
if (AppInitMain(*m_context, tip_info)) return true;
|
||||
// Error during initialization, set exit status before continue
|
||||
m_context->exit_status.store(EXIT_FAILURE);
|
||||
return false;
|
||||
}
|
||||
void appShutdown() override
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user