node::WaitTipChanged

Waits for the connected tip to change until timeout has elapsed. During node initialization, this will wait until the tip is connected (regardless of timeout). Returns the current tip, or nullopt if the node is shutting down or interrupt() is called.

Synopsis

Declared in <node/miner.h>

std::optional<interfaces::BlockRef>
WaitTipChanged(
    ChainstateManager& chainman,
    KernelNotifications& kernel_notifications,
    uint256 const& current_tip,
    MillisecondsDouble& timeout,
    bool& interrupt);

Return Value

The new tip reference, or std::nullopt if shutting down or interrupted.

Parameters

NameDescription
chainmanThe chainstate manager to query.
kernel_notificationsThe notifications object used to wait for tip changes.
current_tipThe tip hash to wait for a change from.
timeoutMaximum time to wait; updated with the remaining time.
interruptFlag that, when set, ends the wait early.