Module service

Source
Expand description

[tower::Service]s for Zebra’s cached chain state.

Zebra provides cached state access via two main services:

Most users should prefer ReadStateService, unless they need to write blocks to the state.

Zebra also provides access to the best chain tip via:

  • LatestChainTip: a read-only channel that contains the latest committed tip.
  • ChainTipChange: a read-only channel that can asynchronously await chain tip changes.

Re-exports§

pub use finalized_state::OutputIndex;
pub use finalized_state::OutputLocation;
pub use finalized_state::TransactionIndex;
pub use finalized_state::TransactionLocation;

Modules§

arbitrary
Arbitrary data generation and test setup for Zebra’s state.
block_iter
Iterators for blocks in the non-finalized and finalized state.
chain_tip
Access to Zebra chain tip information.
check
Consensus critical contextual checks
finalized_state 🔒
The primary implementation of the zebra_state::Service built upon rocksdb.
non_finalized_state 🔒
Non-finalized chain state management as defined by RFC0005
pending_utxos 🔒
Pending UTXO tracker for AwaitUtxo requests.
queued_blocks 🔒
Queued blocks that are awaiting their parent block for verification.
read 🔒
Shared state reading code.
watch_receiver
Shared [tokio::sync::watch] channel wrappers.
write 🔒
Writing blocks to the finalized and non-finalized states.

Structs§

ReadStateService
A read-only service for accessing Zebra’s cached blockchain state.
StateService 🔒
A read-write service for Zebra’s cached blockchain state.

Functions§

init
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.
init_read_only
Initialize a read state service from the provided Config. Returns a read-only state service,
init_test
Returns a StateService with an ephemeral Config and a buffer with a single slot.
init_test_services
Initializes a state service with an ephemeral Config and a buffer with a single slot, then returns the read-write service, read-only service, and tip watch channels.
spawn_init
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.
spawn_init_read_only
Calls init_read_only with the provided Config and Network from a blocking task. Returns a [tokio::task::JoinHandle] with a read state service and chain tip sender.