zebra_state

Function init

source
pub fn init(
    config: Config,
    network: &Network,
    max_checkpoint_height: Height,
    checkpoint_verify_concurrency_limit: usize,
) -> (BoxService<Request, Response, BoxError>, ReadStateService, LatestChainTip, ChainTipChange)
Expand description

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.

Each network has its own separate on-disk database.

The state uses the max_checkpoint_height and checkpoint_verify_concurrency_limit to work out when it is near the final checkpoint.

To share access to the state, wrap the returned service in a Buffer, or clone the returned ReadStateService.

It’s possible to construct multiple state services in the same application (as long as they, e.g., use different storage locations), but doing so is probably not what you want.