logo
pub trait ChainTip {
    fn best_tip_height(&self) -> Option<Height>;
    fn best_tip_hash(&self) -> Option<Hash>;
    fn best_tip_height_and_hash(&self) -> Option<(Height, Hash)>;
    fn best_tip_block_time(&self) -> Option<DateTime<Utc>>;
    fn best_tip_height_and_block_time(&self) -> Option<(Height, DateTime<Utc>)>;
    fn best_tip_mined_transaction_ids(&self) -> Arc<[Hash]>;

    fn estimate_network_chain_tip_height(
        &self,
        network: Network,
        now: DateTime<Utc>
    ) -> Option<Height> { ... } }
Expand description

An interface for querying the chain tip.

This trait helps avoid dependencies between:

  • zebra-chain and tokio
  • zebra-network and zebra-state

Required Methods

Return the height of the best chain tip.

Return the block hash of the best chain tip.

Return the height and the hash of the best chain tip.

Return the block time of the best chain tip.

Return the height and the block time of the best chain tip.

Returning both values at the same time guarantees that they refer to the same chain tip.

Return the mined transaction IDs of the transactions in the best chain tip block.

All transactions with these mined IDs should be rejected from the mempool, even if their authorizing data is different.

Provided Methods

Return an estimate of the network chain tip’s height.

The estimate is calculated based on the current local time, the block time of the best tip and the height of the best tip.

Implementors