From 6eb33bd0c21b3e075fbab596351cacafdc947472 Mon Sep 17 00:00:00 2001 From: TheCharlatan Date: Tue, 9 May 2023 11:15:46 +0200 Subject: kernel: Add fatalError method to notifications FatalError replaces what previously was the AbortNode function in shutdown.cpp. This commit is part of the libbitcoinkernel project and further removes the shutdown's and, more generally, the kernel library's dependency on interface_ui with a kernel notification method. By removing interface_ui from the kernel library, its dependency on boost is reduced to just boost::multi_index. At the same time it also takes a step towards de-globalising the interrupt infrastructure. Co-authored-by: Russell Yanofsky Co-authored-by: TheCharlatan --- src/index/base.cpp | 6 ++++-- src/index/base.h | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'src/index') diff --git a/src/index/base.cpp b/src/index/base.cpp index 99c33d53ba..cf07cae286 100644 --- a/src/index/base.cpp +++ b/src/index/base.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -30,9 +31,10 @@ constexpr auto SYNC_LOG_INTERVAL{30s}; constexpr auto SYNC_LOCATOR_WRITE_INTERVAL{30s}; template -static void FatalErrorf(const char* fmt, const Args&... args) +void BaseIndex::FatalErrorf(const char* fmt, const Args&... args) { - AbortNode(tfm::format(fmt, args...)); + auto message = tfm::format(fmt, args...); + node::AbortNode(m_chain->context()->exit_status, message); } CBlockLocator GetLocator(interfaces::Chain& chain, const uint256& block_hash) diff --git a/src/index/base.h b/src/index/base.h index 231f36b605..8affee90f8 100644 --- a/src/index/base.h +++ b/src/index/base.h @@ -94,6 +94,9 @@ private: virtual bool AllowPrune() const = 0; + template + void FatalErrorf(const char* fmt, const Args&... args); + protected: std::unique_ptr m_chain; Chainstate* m_chainstate{nullptr}; -- cgit v1.2.3