Skip to main content

run_block_notify

Function run_block_notify 

Source
pub async fn run_block_notify(
    command: String,
    sync_status: SyncStatus,
    chain_tip_change: ChainTipChange,
) -> Result<(), BlockNotifyError>
Expand description

Run continuously, executing command whenever the best chain tip changes.

Mirrors zcashd’s -blocknotify: each %s in command is replaced with the new tip’s block hash in getbestblockhash hex format, and the command is run detached via the system shell.

The command is only run once the node is close to the network tip, which is Zebra’s analogue of zcashd suppressing the callback during initial block download. If a lot of blocks are committed at once, intermediate tip hashes are coalesced into a single Reset by ChainTipChange, so only the current best tip hash fires.

Returns an error if communication with the state or the syncer is lost.