In commit “kernel: Remove key module from kernel library” (a885a166cec6d84d08600f12b25d912bd28af80e)
Not directly related to this PR, but I think the code comment above is basically out of date. Initial idea for kernel::Context
was to have it hold a collection of variables that kernel code needed to run, so kernel code could use the context struct instead of global variables, and application code would still be convenient to write.
But this was before Options structs were introduced, and currently code is only passing around options structs, not the Context struct as anticipated. So I think at this point it would be good describe the kernel::Context
more accurately and probably make it a class instead of struct. Maybe:
0//! RAII initializer for global kernel state, running initialization code that
1//! should execute before other kernel code on construction, and running cleanup
2//! meant to execute after other kernel code on destruction.
3//!
4//! This class initializes global state used by kernel code, including RNG and
5//! SHA256 state. In the future, this could initialize more global state if more
6//! globals are added, or become a no-op if globals are removed.
7//!
8//! Note: The `kernel::Context` class has a different role from `NodeContext`
9//! and `WalletContext` structs, despite being similarly named. The kernel
10//! context class is used to initialize global state, while the node and wallet
11//! context structs are meant hold state themselves and remove the need for
12//! global state.
13class Context