2016-09-08 21:13:10 +04:00
|
|
|
(**************************************************************************)
|
|
|
|
(* *)
|
2017-11-14 03:36:14 +04:00
|
|
|
(* Copyright (c) 2014 - 2017. *)
|
2016-09-08 21:13:10 +04:00
|
|
|
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
|
|
|
(* *)
|
|
|
|
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
|
|
|
(* *)
|
|
|
|
(**************************************************************************)
|
|
|
|
|
|
|
|
type t
|
|
|
|
|
2017-01-23 14:10:07 +04:00
|
|
|
type config = {
|
2017-02-24 20:17:53 +04:00
|
|
|
genesis: State.Net.genesis ;
|
2017-01-23 14:10:07 +04:00
|
|
|
store_root: string ;
|
|
|
|
context_root: string ;
|
|
|
|
patch_context: (Context.t -> Context.t Lwt.t) option ;
|
|
|
|
p2p: (P2p.config * P2p.limits) option ;
|
2017-04-10 23:14:17 +04:00
|
|
|
test_network_max_tll: int option ;
|
2017-11-11 06:34:12 +04:00
|
|
|
bootstrap_threshold: int ;
|
2017-01-23 14:10:07 +04:00
|
|
|
}
|
|
|
|
|
2017-11-13 17:25:02 +04:00
|
|
|
and timeout = {
|
|
|
|
block_header: float ;
|
|
|
|
block_operations: float ;
|
|
|
|
protocol: float ;
|
|
|
|
new_head_request: float ;
|
|
|
|
}
|
2017-11-29 16:51:06 +04:00
|
|
|
and prevalidator_limits = {
|
|
|
|
max_refused_operations: int ;
|
2017-11-30 21:34:22 +04:00
|
|
|
operation_timeout: float ;
|
|
|
|
worker_limits : Worker_types.limits ;
|
2017-11-29 16:51:06 +04:00
|
|
|
}
|
2017-11-13 17:25:02 +04:00
|
|
|
|
2017-11-29 16:51:06 +04:00
|
|
|
val create: config -> timeout -> prevalidator_limits -> t tzresult Lwt.t
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
module RPC : sig
|
|
|
|
|
|
|
|
type block = Node_rpc_services.Blocks.block
|
|
|
|
type block_info = Node_rpc_services.Blocks.block_info
|
|
|
|
|
|
|
|
val inject_block:
|
2017-11-14 06:14:26 +04:00
|
|
|
t -> ?force:bool -> ?net_id:Net_id.t ->
|
2017-11-14 02:27:19 +04:00
|
|
|
MBytes.t -> Operation.t list list ->
|
2017-02-24 20:17:53 +04:00
|
|
|
(Block_hash.t * unit tzresult Lwt.t) tzresult Lwt.t
|
2017-03-08 21:47:01 +04:00
|
|
|
(** [inject_block node ?force bytes] tries to insert [bytes]
|
|
|
|
(supposedly the serialization of a block header) inside
|
|
|
|
[node]. If [?force] is true, the block will be inserted even on
|
|
|
|
non strictly increasing fitness. *)
|
|
|
|
|
2016-09-08 21:13:10 +04:00
|
|
|
val inject_operation:
|
2017-11-23 19:39:33 +04:00
|
|
|
t -> ?net_id:Net_id.t -> MBytes.t ->
|
2017-02-24 20:17:53 +04:00
|
|
|
(Operation_hash.t * unit tzresult Lwt.t) Lwt.t
|
2016-10-21 16:01:20 +04:00
|
|
|
val inject_protocol:
|
2017-04-19 21:21:23 +04:00
|
|
|
t -> ?force:bool -> Protocol.t ->
|
2017-02-24 20:17:53 +04:00
|
|
|
(Protocol_hash.t * unit tzresult Lwt.t) Lwt.t
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
val raw_block_info:
|
|
|
|
t -> Block_hash.t -> block_info Lwt.t
|
2017-04-19 23:46:10 +04:00
|
|
|
val block_header_watcher:
|
2017-11-27 09:13:12 +04:00
|
|
|
t -> (Block_hash.t * Block_header.t) Lwt_stream.t * Lwt_watcher.stopper
|
2017-04-19 23:46:10 +04:00
|
|
|
val block_watcher:
|
2017-11-27 09:13:12 +04:00
|
|
|
t -> (block_info Lwt_stream.t * Lwt_watcher.stopper)
|
2017-02-24 20:17:53 +04:00
|
|
|
val heads: t -> block_info Block_hash.Map.t Lwt.t
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-02-15 23:38:00 +04:00
|
|
|
val predecessors:
|
|
|
|
t -> int -> Block_hash.t -> Block_hash.t list Lwt.t
|
|
|
|
|
2016-09-08 21:13:10 +04:00
|
|
|
val list:
|
|
|
|
t -> int -> Block_hash.t list -> block_info list list Lwt.t
|
|
|
|
|
2017-11-27 01:21:56 +04:00
|
|
|
val list_invalid:
|
|
|
|
t -> (Block_hash.t * int32 * error list) list Lwt.t
|
|
|
|
|
2018-01-13 02:57:08 +04:00
|
|
|
val unmark_invalid:
|
|
|
|
t -> Block_hash.t -> unit tzresult Lwt.t
|
|
|
|
|
2016-09-08 21:13:10 +04:00
|
|
|
val block_info:
|
|
|
|
t -> block -> block_info Lwt.t
|
|
|
|
|
2017-04-19 23:46:10 +04:00
|
|
|
val operation_hashes:
|
2017-03-30 15:16:21 +04:00
|
|
|
t -> block -> Operation_hash.t list list Lwt.t
|
2017-04-19 23:46:10 +04:00
|
|
|
val operations:
|
|
|
|
t -> block -> Operation.t list list Lwt.t
|
2016-09-08 21:13:10 +04:00
|
|
|
val operation_watcher:
|
2017-11-27 09:13:12 +04:00
|
|
|
t -> (Operation_hash.t * Operation.t) Lwt_stream.t * Lwt_watcher.stopper
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
val pending_operations:
|
2017-11-27 09:13:12 +04:00
|
|
|
t -> block ->
|
|
|
|
(error Preapply_result.t * Operation.t Operation_hash.Map.t) Lwt.t
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2016-10-21 16:01:20 +04:00
|
|
|
val protocols:
|
|
|
|
t -> Protocol_hash.t list Lwt.t
|
|
|
|
val protocol_content:
|
2017-04-19 21:21:23 +04:00
|
|
|
t -> Protocol_hash.t -> Protocol.t tzresult Lwt.t
|
2016-10-21 16:01:20 +04:00
|
|
|
val protocol_watcher:
|
2017-11-27 09:13:12 +04:00
|
|
|
t -> (Protocol_hash.t * Protocol.t) Lwt_stream.t * Lwt_watcher.stopper
|
2016-10-21 16:01:20 +04:00
|
|
|
|
2016-09-08 21:13:10 +04:00
|
|
|
val context_dir:
|
2017-12-09 06:51:58 +04:00
|
|
|
t -> block -> 'a RPC_directory.t option Lwt.t
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
val preapply:
|
|
|
|
t -> block ->
|
2017-04-27 03:01:05 +04:00
|
|
|
timestamp:Time.t -> proto_header:MBytes.t ->
|
2017-12-05 18:17:57 +04:00
|
|
|
sort_operations:bool -> Operation.t list list ->
|
|
|
|
(Block_header.shell_header * error Preapply_result.t list) tzresult Lwt.t
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2016-11-14 19:26:34 +04:00
|
|
|
val context_dir:
|
2017-12-09 06:51:58 +04:00
|
|
|
t -> block -> 'a RPC_directory.t option Lwt.t
|
2016-11-14 19:26:34 +04:00
|
|
|
|
|
|
|
val complete:
|
|
|
|
t -> ?block:block -> string -> string list Lwt.t
|
|
|
|
|
2017-02-28 03:48:22 +04:00
|
|
|
val bootstrapped:
|
2017-12-09 06:51:58 +04:00
|
|
|
t -> (Block_hash.t * Time.t) RPC_answer.stream
|
2017-02-28 03:48:22 +04:00
|
|
|
|
2017-02-17 22:12:06 +04:00
|
|
|
module Network : sig
|
2017-02-28 03:48:22 +04:00
|
|
|
|
2017-11-27 09:13:12 +04:00
|
|
|
open P2p_types
|
|
|
|
|
|
|
|
val stat : t -> Stat.t
|
|
|
|
|
|
|
|
val watch :
|
|
|
|
t ->
|
|
|
|
P2p_types.Connection_pool_log_event.t Lwt_stream.t * Lwt_watcher.stopper
|
|
|
|
val connect : t -> Point.t -> float -> unit tzresult Lwt.t
|
2017-02-17 22:12:06 +04:00
|
|
|
|
|
|
|
module Connection : sig
|
2017-11-27 09:13:12 +04:00
|
|
|
val info : t -> Peer_id.t -> Connection_info.t option
|
|
|
|
val kick : t -> Peer_id.t -> bool -> unit Lwt.t
|
|
|
|
val list : t -> Connection_info.t list
|
2017-02-17 22:12:06 +04:00
|
|
|
val count : t -> int
|
|
|
|
end
|
|
|
|
|
2017-11-27 09:13:12 +04:00
|
|
|
module Point : sig
|
|
|
|
|
|
|
|
val info :
|
|
|
|
t -> Point.t -> P2p_types.Point_info.t option
|
|
|
|
|
|
|
|
val list :
|
|
|
|
?restrict: P2p_types.Point_state.t list ->
|
|
|
|
t -> (Point.t * P2p_types.Point_info.t) list
|
|
|
|
|
|
|
|
val events :
|
|
|
|
?max:int -> ?rev:bool -> t -> Point.t ->
|
|
|
|
P2p_connection_pool_types.Point_info.Event.t list
|
|
|
|
|
|
|
|
val watch :
|
|
|
|
t -> Point.t ->
|
|
|
|
P2p_connection_pool_types.Point_info.Event.t Lwt_stream.t * Lwt_watcher.stopper
|
|
|
|
|
2017-02-17 22:12:06 +04:00
|
|
|
end
|
|
|
|
|
2017-11-27 09:13:12 +04:00
|
|
|
module Peer_id : sig
|
|
|
|
|
|
|
|
val info :
|
|
|
|
t -> Peer_id.t -> P2p_types.Peer_info.t option
|
|
|
|
|
|
|
|
val list :
|
|
|
|
?restrict: P2p_types.Peer_state.t list ->
|
|
|
|
t -> (Peer_id.t * P2p_types.Peer_info.t) list
|
|
|
|
|
|
|
|
val events :
|
|
|
|
?max: int -> ?rev: bool ->
|
|
|
|
t -> Peer_id.t ->
|
|
|
|
P2p_connection_pool_types.Peer_info.Event.t list
|
|
|
|
|
|
|
|
val watch :
|
|
|
|
t -> Peer_id.t ->
|
|
|
|
P2p_connection_pool_types.Peer_info.Event.t Lwt_stream.t * Lwt_watcher.stopper
|
|
|
|
|
2017-02-17 22:12:06 +04:00
|
|
|
end
|
2017-02-28 03:48:22 +04:00
|
|
|
|
2017-02-17 22:12:06 +04:00
|
|
|
end
|
2017-02-28 03:48:22 +04:00
|
|
|
|
2016-09-08 21:13:10 +04:00
|
|
|
end
|
|
|
|
|
|
|
|
val shutdown: t -> unit Lwt.t
|