2017-09-29 20:43:13 +04:00
|
|
|
(**************************************************************************)
|
|
|
|
(* *)
|
2017-11-14 03:36:14 +04:00
|
|
|
(* Copyright (c) 2014 - 2017. *)
|
2017-09-29 20:43:13 +04:00
|
|
|
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
|
|
|
(* *)
|
|
|
|
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
|
|
|
(* *)
|
|
|
|
(**************************************************************************)
|
|
|
|
|
2017-12-17 22:51:06 +04:00
|
|
|
type t = private raw
|
2017-09-29 20:43:13 +04:00
|
|
|
(** A type for sparse block locator (/à la/ Bitcoin) *)
|
|
|
|
|
2017-12-17 22:51:06 +04:00
|
|
|
and raw = Block_header.t * Block_hash.t list
|
|
|
|
(** Non private version of Block_store_locator.t for coercions *)
|
2017-09-29 20:43:13 +04:00
|
|
|
|
2017-12-17 22:51:06 +04:00
|
|
|
val raw: t -> raw
|
2017-09-29 20:43:13 +04:00
|
|
|
|
2017-12-17 22:51:06 +04:00
|
|
|
val encoding: t Data_encoding.t
|
|
|
|
|
2018-01-22 22:25:07 +04:00
|
|
|
val compute:
|
|
|
|
pred:(Block_hash.t -> int -> Block_hash.t option Lwt.t) ->
|
|
|
|
Block_hash.t -> Block_header.t -> int ->
|
|
|
|
t Lwt.t
|
2017-09-29 20:43:13 +04:00
|
|
|
|
2017-12-17 22:51:06 +04:00
|
|
|
type validity =
|
|
|
|
| Unknown
|
|
|
|
| Known_valid
|
|
|
|
| Known_invalid
|
2017-09-29 20:43:13 +04:00
|
|
|
|
2017-12-17 22:51:06 +04:00
|
|
|
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. *)
|