mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-02 09:15:04 +02:00
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>
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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};
|
||||
|
||||
Reference in New Issue
Block a user