Proto/env: allow some Lwt
in the construction of rpc_context
This commit is contained in:
parent
82530eeb29
commit
91143452e3
@ -96,7 +96,7 @@ module type T = sig
|
||||
validation_state -> operation -> validation_state tzresult Lwt.t
|
||||
val finalize_block:
|
||||
validation_state -> validation_result tzresult Lwt.t
|
||||
val rpc_services: rpc_context RPC_directory.t
|
||||
val rpc_services: rpc_context Lwt.t RPC_directory.t
|
||||
val configure_sandbox:
|
||||
context -> Data_encoding.json option -> context tzresult Lwt.t
|
||||
end
|
||||
|
@ -89,7 +89,7 @@ module type T = sig
|
||||
validation_state -> operation -> validation_state tzresult Lwt.t
|
||||
val finalize_block:
|
||||
validation_state -> validation_result tzresult Lwt.t
|
||||
val rpc_services: rpc_context RPC_directory.t
|
||||
val rpc_services: rpc_context Lwt.t RPC_directory.t
|
||||
val configure_sandbox:
|
||||
context -> Data_encoding.json option -> context tzresult Lwt.t
|
||||
end
|
||||
|
@ -66,7 +66,7 @@ module Make(Context : Protocol_environment.CONTEXT) = struct
|
||||
validation_state -> operation -> validation_state tzresult Lwt.t
|
||||
val finalize_block:
|
||||
validation_state -> validation_result tzresult Lwt.t
|
||||
val rpc_services: rpc_context RPC_directory.t
|
||||
val rpc_services: rpc_context Lwt.t RPC_directory.t
|
||||
val configure_sandbox:
|
||||
Context.t -> Data_encoding.json option -> Context.t tzresult Lwt.t
|
||||
end
|
||||
|
@ -147,7 +147,7 @@ module type PROTOCOL = sig
|
||||
validation_state -> validation_result tzresult Lwt.t
|
||||
|
||||
(** The list of remote procedures exported by this implementation *)
|
||||
val rpc_services: rpc_context RPC_directory.t
|
||||
val rpc_services: rpc_context Lwt.t RPC_directory.t
|
||||
|
||||
(** An ad-hoc context patcher. It used only for debugging protocol
|
||||
while running in the "sandbox" mode. This function is never used
|
||||
|
@ -557,7 +557,7 @@ module RPC = struct
|
||||
| Some rpc_context ->
|
||||
Context.get_protocol rpc_context.context >>= fun protocol_hash ->
|
||||
let (module Proto) = Registred_protocol.get_exn protocol_hash in
|
||||
let dir = RPC_directory.map (fun () -> rpc_context) Proto.rpc_services in
|
||||
let dir = RPC_directory.map (fun () -> Lwt.return rpc_context) Proto.rpc_services in
|
||||
Lwt.return (Some (RPC_directory.map (fun _ -> ()) dir))
|
||||
|
||||
let heads node =
|
||||
|
@ -17,16 +17,16 @@ type rpc_context = {
|
||||
context: Tezos_context.t ;
|
||||
}
|
||||
|
||||
let rpc_init
|
||||
({ block_hash ; block_header ;
|
||||
operation_hashes ; operations ; context } : Updater.rpc_context) =
|
||||
let rpc_init (rpc_context : Updater.rpc_context Lwt.t) =
|
||||
rpc_context >>= fun { block_hash ; block_header ;
|
||||
operation_hashes ; operations ; context } ->
|
||||
let level = Int32.succ block_header.shell.level in
|
||||
let timestamp = block_header.shell.timestamp in
|
||||
let fitness = block_header.shell.fitness in
|
||||
Tezos_context.init ~level ~timestamp ~fitness context >>=? fun context ->
|
||||
return { block_hash ; block_header ; operation_hashes ; operations ; context }
|
||||
|
||||
let rpc_services = ref (RPC_directory.empty : Updater.rpc_context RPC_directory.t)
|
||||
let rpc_services = ref (RPC_directory.empty : Updater.rpc_context Lwt.t RPC_directory.t)
|
||||
|
||||
let register0_fullctxt s f =
|
||||
rpc_services :=
|
||||
|
@ -23,7 +23,7 @@ let failing_service custom_root =
|
||||
~output: Data_encoding.empty
|
||||
RPC_path.(custom_root / "failing")
|
||||
|
||||
let rpc_services : Updater.rpc_context RPC_directory.t =
|
||||
let rpc_services : Updater.rpc_context Lwt.t RPC_directory.t =
|
||||
let dir = RPC_directory.empty in
|
||||
let dir =
|
||||
RPC_directory.register
|
||||
|
@ -35,7 +35,7 @@ let int64_to_bytes i =
|
||||
let operations_hash =
|
||||
Operation_list_list_hash.compute []
|
||||
|
||||
let rpc_services : Updater.rpc_context RPC_directory.t =
|
||||
let rpc_services : Updater.rpc_context Lwt.t RPC_directory.t =
|
||||
let dir = RPC_directory.empty in
|
||||
let dir =
|
||||
RPC_directory.register
|
||||
|
Loading…
Reference in New Issue
Block a user