diff --git a/src/lib_shell/state.ml b/src/lib_shell/state.ml index 5f21d1b26..12ab06481 100644 --- a/src/lib_shell/state.ml +++ b/src/lib_shell/state.ml @@ -541,6 +541,11 @@ module Block = struct read_exn net_state header.shell.predecessor >>= fun 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 let () = diff --git a/src/lib_shell/state.mli b/src/lib_shell/state.mli index 9f3e39c38..813459552 100644 --- a/src/lib_shell/state.mli +++ b/src/lib_shell/state.mli @@ -138,6 +138,7 @@ module Block : sig val is_genesis: t -> bool 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 protocol_hash: t -> Protocol_hash.t Lwt.t