aboutsummaryrefslogtreecommitdiff
path: root/src/index
diff options
context:
space:
mode:
authorTheCharlatan <seb.kung@gmail.com>2023-05-09 11:15:46 +0200
committerTheCharlatan <seb.kung@gmail.com>2023-06-28 09:52:33 +0200
commit6eb33bd0c21b3e075fbab596351cacafdc947472 (patch)
tree70c9082689cd178c864faa39bec9b02ea1ac028b /src/index
parent7320db96f8d2aeff0bc5dc67d8b7b37f5f808990 (diff)
downloadbitcoin-6eb33bd0c21b3e075fbab596351cacafdc947472.tar.xz
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 <russ@yanofsky.org> Co-authored-by: TheCharlatan <seb.kung@gmail.com>
Diffstat (limited to 'src/index')
-rw-r--r--src/index/base.cpp6
-rw-r--r--src/index/base.h3
2 files changed, 7 insertions, 2 deletions
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 <interfaces/chain.h>
#include <kernel/chain.h>
#include <logging.h>
+#include <node/abort.h>
#include <node/blockstorage.h>
#include <node/context.h>
#include <node/database_args.h>
@@ -30,9 +31,10 @@ constexpr auto SYNC_LOG_INTERVAL{30s};
constexpr auto SYNC_LOCATOR_WRITE_INTERVAL{30s};
template <typename... Args>
-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 <typename... Args>
+ void FatalErrorf(const char* fmt, const Args&... args);
+
protected:
std::unique_ptr<interfaces::Chain> m_chain;
Chainstate* m_chainstate{nullptr};