State: export predecessor_n

This commit is contained in:
Marco Stronati 2018-02-02 20:40:23 +01:00 committed by Benjamin Canou
parent f8e69ac8f5
commit d05dceb0b0
2 changed files with 6 additions and 0 deletions

View File

@ -541,6 +541,11 @@ module Block = struct
read_exn net_state header.shell.predecessor >>= fun block -> read_exn net_state header.shell.predecessor >>= fun block ->
Lwt.return (Some block) Lwt.return (Some block)
let predecessor_n (net: Net.t) (b: Block_hash.t) (distance: int) : Block_hash.t option Lwt.t =
Shared.use net.block_store (fun store ->
predecessor_n store b distance)
type error += Inconsistent_hash of Context_hash.t * Context_hash.t type error += Inconsistent_hash of Context_hash.t * Context_hash.t
let () = let () =

View File

@ -138,6 +138,7 @@ module Block : sig
val is_genesis: t -> bool val is_genesis: t -> bool
val predecessor: t -> block option Lwt.t val predecessor: t -> block option Lwt.t
val predecessor_n: Net.t -> Block_hash.t -> int -> Block_hash.t option Lwt.t
val context: t -> Context.t Lwt.t val context: t -> Context.t Lwt.t
val protocol_hash: t -> Protocol_hash.t Lwt.t val protocol_hash: t -> Protocol_hash.t Lwt.t