mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-19 06:43:45 +01:00
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>
52 lines
2.1 KiB
C++
52 lines
2.1 KiB
C++
// Copyright (c) 2023 The Bitcoin Core developers
|
|
// Distributed under the MIT software license, see the accompanying
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
#ifndef BITCOIN_KERNEL_NOTIFICATIONS_INTERFACE_H
|
|
#define BITCOIN_KERNEL_NOTIFICATIONS_INTERFACE_H
|
|
|
|
#include <util/translation.h>
|
|
|
|
#include <cstdint>
|
|
#include <string>
|
|
|
|
class CBlockIndex;
|
|
enum class SynchronizationState;
|
|
|
|
namespace kernel {
|
|
|
|
/**
|
|
* A base class defining functions for notifying about certain kernel
|
|
* events.
|
|
*/
|
|
class Notifications
|
|
{
|
|
public:
|
|
virtual ~Notifications(){};
|
|
|
|
virtual void blockTip(SynchronizationState state, CBlockIndex& index) {}
|
|
virtual void headerTip(SynchronizationState state, int64_t height, int64_t timestamp, bool presync) {}
|
|
virtual void progress(const bilingual_str& title, int progress_percent, bool resume_possible) {}
|
|
virtual void warning(const bilingual_str& warning) {}
|
|
|
|
//! The flush error notification is sent to notify the user that an error
|
|
//! occurred while flushing block data to disk. Kernel code may ignore flush
|
|
//! errors that don't affect the immediate operation it is trying to
|
|
//! perform. Applications can choose to handle the flush error notification
|
|
//! by logging the error, or notifying the user, or triggering an early
|
|
//! shutdown as a precaution against causing more errors.
|
|
virtual void flushError(const std::string& debug_message) {}
|
|
|
|
//! The fatal error notification is sent to notify the user when an error
|
|
//! occurs in kernel code that can't be recovered from. After this
|
|
//! notification is sent, whatever function triggered the error should also
|
|
//! return an error code or raise an exception. Applications can choose to
|
|
//! handle the fatal error notification by logging the error, or notifying
|
|
//! the user, or triggering an early shutdown as a precaution against
|
|
//! causing more errors.
|
|
virtual void fatalError(const std::string& debug_message, const bilingual_str& user_message = {}) {}
|
|
};
|
|
} // namespace kernel
|
|
|
|
#endif // BITCOIN_KERNEL_NOTIFICATIONS_INTERFACE_H
|