Crate zebra_state[][src]

Expand description

State contextual verification and storage code for Zebra. 🦓


Await UTXO and block commit requests should be wrapped in a timeout, because:

  • await UTXO requests wait for a block containing that UTXO, and
  • contextual verification and state updates wait for all previous blocks.

Otherwise, verification of out-of-order and invalid blocks can hang indefinitely.


pub use constants::MAX_BLOCK_REORG_HEIGHT;


Definitions of constants.


A chain tip block, with precalculated block data.

A chain tip change monitor.

A sender for changes to the non-finalized and finalized chain tips.

A wrapper for type erased errors that is itself clonable and implements the Error trait

An error describing the reason a block could not be committed to the state.

Configuration for the state service.

A finalized block, ready to be committed directly to the finalized state with no checks.

Efficient access to the state’s current best chain tip.

A block which has undergone semantic validation and has been prepared for contextual validation.


Identify a block by hash or height.

A query about or modification to the chain state.

A response to a state Request.

Actions that we can take in response to a ChainTipChange.

An error describing why a block failed contextual validation.


Initialize a state service from the provided Config. Returns a boxed state service, and receivers for state chain tip updates.

Initialize a state service with an ephemeral Config and a buffer with a single slot.

Type Definitions