package tezos-legacy-store

  1. Overview
  2. Docs

Tezos Shell Module - Chain Traversal API

If h1 is an ancestor of h2 in the current state, then path state h1 h2 returns the chain of block from h1 (excluded) to h2 (included). Returns None otherwise.

common_ancestor state h1 h2 returns the first common ancestors in the history of blocks h1 and h2.

val iter_predecessors : ?max:int -> ?min_fitness:Tezos_base.Fitness.t -> ?min_date:Tezos_base.Time.Protocol.t -> Legacy_state.Block.t list -> f:(Legacy_state.Block.t -> unit Lwt.t) -> unit Lwt.t

iter_predecessors state blocks f iter f on blocks and their recursive predecessors. Blocks are visited with a decreasing fitness (then decreasing timestamp). If the optional argument max is provided, the iteration is stopped after max visited block. If min_fitness id provided, blocks with a fitness lower than min_fitness are ignored. If min_date, blocks with a fitness lower than min_date are ignored.

new_blocks ~from_block ~to_block returns a pair (ancestor, path), where ancestor is the common ancestor of from_block and to_block and where path is the chain from ancestor (excluded) to to_block (included). The function raises an exception when the two provided blocks do not belong to the same chain.

live_blocks b n return a pair (blocks,operations) where blocks is the set of arity n, that contains b and its n-1 predecessors. And where operations is the set of operations included in those blocks.