package tezos-legacy-store

  1. Overview
  2. Docs
type t = {
  1. chain_state : Chain.t;
  2. hash : Tezos_crypto.Block_hash.t;
  3. header : Tezos_base.Block_header.t;
}
type block = t
module Header : sig ... end

Abstract view over block header storage. This module aims to abstract over block header's read, read_opt and known functions by calling the adequate function depending on the block being pruned or not.

val known : Chain.t -> Tezos_crypto.Block_hash.t -> bool Lwt.t
val known_valid : Chain.t -> Tezos_crypto.Block_hash.t -> bool Lwt.t
val known_invalid : Chain.t -> Tezos_crypto.Block_hash.t -> bool Lwt.t
val list_invalid : Chain.t -> (Tezos_crypto.Block_hash.t * int32 * Tezos_error_monad.TzCore.error list) list Lwt.t
val unmark_invalid : Chain.t -> Tezos_crypto.Block_hash.t -> (unit, Tezos_error_monad.TzCore.error list) Stdlib.result Lwt.t
val read_contents_opt : t -> Legacy_store.Block.contents option Lwt.t
val read_opt : Chain.t -> Tezos_crypto.Block_hash.t -> t option Lwt.t
val read_predecessor : Chain.t -> pred:int -> Tezos_crypto.Block_hash.t -> t option Lwt.t

Will return the full block if the block has never been cleaned (all blocks for nodes whose history-mode is set to archive), only the header for nodes below the save point (nodes in full or rolling history-mode). Will fail with `Not_found` if the given hash is unknown.

val store : Chain.t -> Tezos_base.Block_header.t -> Stdlib.Bytes.t -> Tezos_base.Operation.t list list -> Stdlib.Bytes.t list list -> Tezos_crypto.Block_metadata_hash.t option -> Tezos_crypto.Operation_metadata_hash.t list list option -> Tezos_validation.Block_validation.validation_store -> forking_testchain:bool -> (block option, Tezos_error_monad.TzCore.error list) Stdlib.result Lwt.t
val store_invalid : Chain.t -> Tezos_base.Block_header.t -> Tezos_error_monad.TzCore.error list -> (bool, Tezos_error_monad.TzCore.error list) Stdlib.result Lwt.t
val remove : t -> (unit, Tezos_error_monad.TzCore.error list) Stdlib.result Lwt.t

remove block deletes every occurrence of block in the different stores. If block is the current head, the head is also backtracked to the block predecessor

val compare : t -> t -> int
val equal : t -> t -> bool
val timestamp : t -> Tezos_base.Time.Protocol.t
val fitness : t -> Tezos_base.Fitness.t
val validation_passes : t -> int
val chain_id : t -> Tezos_crypto.Chain_id.t
val chain_state : t -> Chain.t
val level : t -> Stdlib.Int32.t
val message : t -> (string option, Tezos_error_monad.TzCore.error list) Stdlib.result Lwt.t
val max_operations_ttl : t -> (int, Tezos_error_monad.TzCore.error list) Stdlib.result Lwt.t
val metadata : t -> (Stdlib.Bytes.t, Tezos_error_monad.TzCore.error list) Stdlib.result Lwt.t
val last_allowed_fork_level : t -> (Stdlib.Int32.t, Tezos_error_monad.TzCore.error list) Stdlib.result Lwt.t
val is_genesis : t -> bool
val predecessor : t -> t option Lwt.t
val predecessor_n : t -> int -> Tezos_crypto.Block_hash.t option Lwt.t
val is_valid_for_checkpoint : t -> Tezos_base.Block_header.t -> bool Lwt.t
val context : t -> (Tezos_context.Context.t, Tezos_error_monad.TzCore.error list) Stdlib.result Lwt.t
val context_opt : t -> Tezos_context.Context.t option Lwt.t
val context_exn : t -> Tezos_context.Context.t Lwt.t
val context_exists : t -> bool Lwt.t
val protocol_hash : t -> (Tezos_crypto.Protocol_hash.t, Tezos_error_monad.TzCore.error list) Stdlib.result Lwt.t
val protocol_hash_exn : t -> Tezos_crypto.Protocol_hash.t Lwt.t
val test_chain : t -> (Tezos_base.Test_chain_status.t * t option) Lwt.t
val protocol_level : t -> int
val all_operation_hashes : t -> Tezos_crypto.Operation_hash.t list list Lwt.t
val all_operations : t -> Tezos_base.Operation.t list list Lwt.t
val operations_metadata : t -> int -> Stdlib.Bytes.t list Lwt.t
val all_operations_metadata : t -> Stdlib.Bytes.t list list Lwt.t
val metadata_hash : t -> Tezos_crypto.Block_metadata_hash.t option Lwt.t
val operations_metadata_hashes : t -> int -> Tezos_crypto.Operation_metadata_hash.t list option Lwt.t
val all_operations_metadata_hashes : t -> Tezos_crypto.Operation_metadata_hash.t list list option Lwt.t
val all_operations_metadata_hash : t -> Tezos_crypto.Operation_metadata_list_list_hash.t option Lwt.t

known_ancestor chain_state locator computes the unknown prefix in the locator according to chain_state. It either returns:

  • Some (h, hist) when we find a valid block, where hist is the unknown prefix, ending with the first valid block found.
  • Some (h, hist) when we don't find any block known valid nor invalid and the node runs in full or rolling mode. In this case (h, hist) is the given locator.
  • None when the node runs in archive history mode and we find an invalid block or no valid block in the locator.
  • None when the node runs in full or rolling mode and we find an invalid block in the locator.
val get_rpc_directory : t -> t Tezos_rpc.RPC_directory.t option Lwt.t
val set_rpc_directory : t -> t Tezos_rpc.RPC_directory.t -> (unit, Tezos_error_monad.TzCore.error list) Stdlib.result Lwt.t
OCaml

Innovation. Community. Security.