Bitcoin Core 31.0.0
P2P Digital Currency
Loading...
Searching...
No Matches
KernelNotifications Class Reference

#include <kernel_notifications.h>

Inheritance diagram for KernelNotifications:
[legend]
Collaboration diagram for KernelNotifications:
[legend]

Public Member Functions

 KernelNotifications (const std::function< bool()> &shutdown_request, std::atomic< int > &exit_status, node::Warnings &warnings)
kernel::InterruptResult blockTip (SynchronizationState state, const CBlockIndex &index, double verification_progress) override EXCLUSIVE_LOCKS_REQUIRED(!m_tip_block_mutex)
void headerTip (SynchronizationState state, int64_t height, int64_t timestamp, bool presync) override
void progress (const bilingual_str &title, int progress_percent, bool resume_possible) override
void warningSet (kernel::Warning id, const bilingual_str &message) override
void warningUnset (kernel::Warning id) override
void flushError (const bilingual_str &message) override
void fatalError (const bilingual_str &message) override
void setChainstateLoaded (bool chainstate_loaded) EXCLUSIVE_LOCKS_REQUIRED(!m_tip_block_mutex)
std::condition_variable m_tip_block_cv GUARDED_BY (m_tip_block_mutex)
KernelState m_state GUARDED_BY (m_tip_block_mutex)
std::optional< uint256TipBlock () EXCLUSIVE_LOCKS_REQUIRED(m_tip_block_mutex)
Public Member Functions inherited from kernel::Notifications
virtual ~Notifications ()=default

Public Attributes

int m_stop_at_height {DEFAULT_STOPATHEIGHT}
 Block height after which blockTip notification will return Interrupted{}, if >0.
bool m_shutdown_on_fatal_error {true}
 Useful for tests, can be set to false to avoid shutdown on fatal error.
Mutex m_tip_block_mutex

Private Attributes

const std::function< bool()> & m_shutdown_request
std::atomic< int > & m_exit_status
node::Warningsm_warnings

Detailed Description

Definition at line 44 of file kernel_notifications.h.

Constructor & Destructor Documentation

◆ KernelNotifications()

node::KernelNotifications::KernelNotifications ( const std::function< bool()> & shutdown_request,
std::atomic< int > & exit_status,
node::Warnings & warnings )
inline

Definition at line 47 of file kernel_notifications.h.

Member Function Documentation

◆ blockTip()

kernel::InterruptResult node::KernelNotifications::blockTip ( SynchronizationState state,
const CBlockIndex & index,
double verification_progress )
nodiscardoverridevirtual

Reimplemented from kernel::Notifications.

Definition at line 51 of file kernel_notifications.cpp.

◆ fatalError()

void node::KernelNotifications::fatalError ( const bilingual_str & message)
overridevirtual

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.

Reimplemented from kernel::Notifications.

Definition at line 97 of file kernel_notifications.cpp.

◆ flushError()

void node::KernelNotifications::flushError ( const bilingual_str & message)
overridevirtual

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.

Reimplemented from kernel::Notifications.

Definition at line 92 of file kernel_notifications.cpp.

◆ GUARDED_BY() [1/2]

◆ GUARDED_BY() [2/2]

std::condition_variable m_tip_block_cv node::KernelNotifications::GUARDED_BY ( m_tip_block_mutex )

◆ headerTip()

void node::KernelNotifications::headerTip ( SynchronizationState state,
int64_t height,
int64_t timestamp,
bool presync )
overridevirtual

Reimplemented from kernel::Notifications.

Definition at line 70 of file kernel_notifications.cpp.

◆ progress()

void node::KernelNotifications::progress ( const bilingual_str & title,
int progress_percent,
bool resume_possible )
overridevirtual

Reimplemented from kernel::Notifications.

Definition at line 75 of file kernel_notifications.cpp.

◆ setChainstateLoaded()

void node::KernelNotifications::setChainstateLoaded ( bool chainstate_loaded)
inline

Definition at line 64 of file kernel_notifications.h.

◆ TipBlock()

The block for which the last blockTip notification was received. It's first set when the tip is connected during node initialization. Might be unset during an early shutdown.

Definition at line 103 of file kernel_notifications.cpp.

◆ warningSet()

void node::KernelNotifications::warningSet ( kernel::Warning id,
const bilingual_str & message )
overridevirtual

Reimplemented from kernel::Notifications.

Definition at line 80 of file kernel_notifications.cpp.

◆ warningUnset()

Reimplemented from kernel::Notifications.

Definition at line 87 of file kernel_notifications.cpp.

Member Data Documentation

◆ m_exit_status

std::atomic<int>& node::KernelNotifications::m_exit_status
private

Definition at line 86 of file kernel_notifications.h.

◆ m_shutdown_on_fatal_error

Useful for tests, can be set to false to avoid shutdown on fatal error.

Definition at line 74 of file kernel_notifications.h.

◆ m_shutdown_request

const std::function<bool()>& node::KernelNotifications::m_shutdown_request
private

Definition at line 85 of file kernel_notifications.h.

◆ m_stop_at_height

Block height after which blockTip notification will return Interrupted{}, if >0.

Definition at line 72 of file kernel_notifications.h.

◆ m_tip_block_mutex

◆ m_warnings


The documentation for this class was generated from the following files: