Page MenuHomePhabricator

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

Authored by PiRK on Fri, Feb 28, 15:25.

Details

Reviewers
None
Group Reviewers
Restricted Project
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