Kernel notification handler that tracks chain state for code above the validation layer.

Synopsis

Declared in <node/kernel_notifications.h>

class KernelNotifications
    : public kernel::Notifications

Base Classes

Name

Description

kernel::Notifications

A base class defining functions for notifying about certain kernel events.

Member Functions

Name

Description

KernelNotifications [constructor]

Construct the notification handler.

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.

blockTip [virtual]

Handle a new chain tip being connected.

fatalError [virtual]

Handle a fatal, unrecoverable error, requesting shutdown unless disabled.

flushError [virtual]

Handle a non‐fatal error while flushing state to disk.

headerTip [virtual]

Handle the best header advancing during headers synchronization.

progress [virtual]

Report progress of a long‐running operation to the UI.

setChainstateLoaded

Record whether the chainstate has finished loading.

warningSet

warningSet overloads

warningUnset

warningUnset overloads

Data Members

Name

Description

m_shutdown_on_fatal_error

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

m_state

Kernel state guarded by m_tip_block_mutex.

m_stop_at_height

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

m_tip_block_cv

Signaled when the tip‐block state changes.

m_tip_block_mutex

Guards the tip‐block state and its condition variable.

Non-Member Functions

Name

Description

InterruptWait

Interrupt a blocking wait call.

::FatalError

Report an unrecoverable error, flag the validation state as failed, and notify the node to shut down.

Created with MrDocs