HomePhabricator

[kernel 2c/n] Introduce kernel::Context, encapsulate global init/teardown

Description

[kernel 2c/n] Introduce kernel::Context, encapsulate global init/teardown

Summary:
The full init/common.cpp is dependent on things like ArgsManager (which we wish to remove from libbitcoinkernel in the future) and sanity checks. These aren't necessary for libbitcoinkernel so we only extract the portion that is necessary (namely init::{Set,Unset}Globals().

Initialize globals with kernel::Context's life instead of explicitly calling init::{Set,Unset}Globals.
Cool thing about this is that in both the testing and bitcoin-chainstate codepaths, we no longer need to explicitly unset globals. The kernel::Context goes out of scope and the globals are unset "automatically".

kernel: SanityChecks: Return an error struct
This reduces libbitcoinkernel's coupling with ui_interface and translation.

This is a backport of core#25065

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D17723

Details

Provenance
Carl Dong <contact@carldong.me>Authored on Mar 3 2022, 01:04
PiRKCommitted on Mon, Mar 3, 16:11
PiRKPushed on Mon, Mar 3, 16:11
Reviewer
Restricted Project
Differential Revision
D17723: [kernel 2c/n] Introduce kernel::Context, encapsulate global init/teardown
Parents
rABCb1e851853035: build: remove ENABLE_GLICB_COMPAT from builds
Branches
Unknown
Tags
Unknown