ligo/src/lib_base/block_locator.mli
2018-01-30 10:13:26 +01:00

35 lines
1.3 KiB
OCaml

(**************************************************************************)
(* *)
(* Copyright (c) 2014 - 2017. *)
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
(* *)
(* All rights reserved. No warranty, explicit or implicit, provided. *)
(* *)
(**************************************************************************)
type t = private raw
(** A type for sparse block locator (/à la/ Bitcoin) *)
and raw = Block_header.t * Block_hash.t list
(** Non private version of Block_store_locator.t for coercions *)
val raw: t -> raw
val encoding: t Data_encoding.t
val compute:
pred:(Block_hash.t -> int -> Block_hash.t option Lwt.t) ->
Block_hash.t -> Block_header.t -> int ->
t Lwt.t
type validity =
| Unknown
| Known_valid
| Known_invalid
val unknown_prefix:
(Block_hash.t -> validity Lwt.t) -> t -> (Block_hash.t * t) option Lwt.t
(** [unknown_prefix validity locator] keeps only the unknown part of
the locator up to the first valid block. If there is no known valid
block or there is a known invalid one, None is returned. *)