Crate zebra_state

source ·
Expand description

State contextual verification and storage code for Zebra.

§Correctness

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.

Re-exports§

Modules§

  • Consensus critical contextual checks
  • Cached state configuration for Zebra.
  • Constants that impact state behaviour.

Structs§

  • A chain tip change monitor.
  • A block ready to be committed directly to the finalized state with a small number of checks if compared with a ContextuallyVerifiedBlock.
  • A wrapper for type erased errors that is itself clonable and implements the Error trait
  • An error describing the reason a semantically verified block could not be committed to the state.
  • Efficient access to the state’s current best chain tip.
  • Information about a transaction in the best chain
  • A transparent output’s index in its transaction.
  • A transparent output’s location in the chain, by block height and transaction index.
  • A block which has undergone semantic validation and has been prepared for contextual validation.
  • A transaction’s index in its block.
  • A transaction’s location in the chain, by block height and transaction index.
  • Efficient access to state data via a tokio watch::Receiver channel, while avoiding deadlocks.

Enums§

Traits§

Functions§

  • Initialize a state service from the provided Config. Returns a boxed state service, a read-only state service, and receivers for state chain tip updates.
  • Calls init with the provided Config and Network from a blocking task. Returns a tokio::task::JoinHandle with a boxed state service, a read state service, and receivers for state chain tip updates.

Type Aliases§