Return EXIT_FAILURE on post-init fatal errors
Summary:
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>
This is a partial backport of core#27708, core#27895 and core#28028
Included commits:
- https://github.com/bitcoin/bitcoin/pull/27708/commits/3b2c61e8198bcefb1c2343caff1d705951026cc4
- https://github.com/bitcoin/bitcoin/pull/27708/commits/4927167f855f8ed3bbf6d2766f61229f742e632a
- core#27895 (clean up TestNode.is_node_stopped)
- core#28028 (bugfix: Check expected_stderr after stop)
Partially included commit: declare NodeContext in the main function and pass it to AppInit:
Depends on D18597
Test Plan: ninja all check-all
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Differential Revision: https://reviews.bitcoinabc.org/D18598