Review report

core: PR #33847

🟡 Minor

Enforce the live-context check in release builds (src/kernel/bitcoinkernel.cpp:638, head)

This invariant uses only assert, which is removed in release builds, before the callback is unconditionally removed from the registry. If a caller destroys a connection while a context still uses it, the context retains a raw connection pointer and later calls AddContextUse(..., -1) from its destructor, potentially accessing the destroyed handle or an invalid callback iterator. The public API documents that this misuse aborts. Use an always-on check before unregistering so release builds uphold that behavior.

The attached logger misses context initialization output (src/kernel/bitcoinkernel.cpp:454, head)

m_context is constructed at line 422, but this connection is not activated until this call. kernel::Context logs the SHA256 implementation announcement during its first construction, and KernelLogger::Log skips callbacks with contexts == 0. As a result, the first context's configured logger misses that entry or another log emitted during construction. Register the connection before constructing the kernel context with exception-safe lifetime management, then retain the use for the context's lifetime.