2016-09-08 21:13:10 +04:00
|
|
|
(**************************************************************************)
|
|
|
|
(* *)
|
|
|
|
(* Copyright (c) 2014 - 2016. *)
|
|
|
|
(* 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 ;
|
|
|
|
test_protocol: Protocol_hash.t option ;
|
|
|
|
patch_context: (Context.t -> Context.t Lwt.t) option ;
|
|
|
|
p2p: (P2p.config * P2p.limits) option ;
|
|
|
|
}
|
|
|
|
|
|
|
|
val create: config -> 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-02-24 20:17:53 +04:00
|
|
|
t -> ?force:bool -> MBytes.t ->
|
|
|
|
(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-02-24 20:17:53 +04:00
|
|
|
t -> ?force:bool -> MBytes.t ->
|
|
|
|
(Operation_hash.t * unit tzresult Lwt.t) Lwt.t
|
2016-10-21 16:01:20 +04:00
|
|
|
val inject_protocol:
|
2017-02-24 20:17:53 +04:00
|
|
|
t -> ?force:bool -> Tezos_compiler.Protocol.t ->
|
|
|
|
(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
|
|
|
|
val block_watcher:
|
2017-02-17 21:15:46 +04:00
|
|
|
t -> block_info Lwt_stream.t * Watcher.stopper
|
2016-09-08 21:13:10 +04:00
|
|
|
val valid_block_watcher:
|
2017-02-24 20:17:53 +04:00
|
|
|
t -> (block_info Lwt_stream.t * Watcher.stopper)
|
|
|
|
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
|
|
|
|
|
|
|
|
val block_info:
|
|
|
|
t -> block -> block_info Lwt.t
|
|
|
|
|
|
|
|
val operations:
|
|
|
|
t -> block -> Operation_hash.t list Lwt.t
|
|
|
|
val operation_content:
|
2017-02-24 20:17:53 +04:00
|
|
|
t -> Operation_hash.t -> Store.Operation.t option Lwt.t
|
2016-09-08 21:13:10 +04:00
|
|
|
val operation_watcher:
|
2017-02-24 20:17:53 +04:00
|
|
|
t -> (Operation_hash.t * Store.Operation.t) Lwt_stream.t * Watcher.stopper
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
val pending_operations:
|
2017-02-24 20:17:53 +04:00
|
|
|
t -> block -> (error Updater.preapply_result * Operation_hash.Set.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-02-24 20:17:53 +04:00
|
|
|
t -> Protocol_hash.t -> Tezos_compiler.Protocol.t tzresult Lwt.t
|
2016-10-21 16:01:20 +04:00
|
|
|
val protocol_watcher:
|
2017-02-24 20:17:53 +04:00
|
|
|
t -> (Protocol_hash.t * Tezos_compiler.Protocol.t) Lwt_stream.t * Watcher.stopper
|
2016-10-21 16:01:20 +04:00
|
|
|
|
2016-09-08 21:13:10 +04:00
|
|
|
val context_dir:
|
|
|
|
t -> block -> 'a RPC.directory option Lwt.t
|
|
|
|
|
|
|
|
val preapply:
|
|
|
|
t -> block ->
|
|
|
|
timestamp:Time.t -> sort:bool ->
|
|
|
|
Operation_hash.t list ->
|
|
|
|
(Protocol.fitness * error Updater.preapply_result) tzresult Lwt.t
|
|
|
|
|
2017-02-24 20:17:53 +04:00
|
|
|
val validate: t -> State.Net_id.t -> Block_hash.t -> unit tzresult Lwt.t
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2016-11-14 19:26:34 +04:00
|
|
|
val context_dir:
|
|
|
|
t -> block -> 'a RPC.directory option Lwt.t
|
|
|
|
|
|
|
|
val complete:
|
|
|
|
t -> ?block:block -> string -> string list Lwt.t
|
|
|
|
|
2017-02-28 03:48:22 +04:00
|
|
|
val bootstrapped:
|
|
|
|
t -> (Block_hash.t * Time.t) RPC.Answer.stream
|
|
|
|
|
2017-02-17 22:12:06 +04:00
|
|
|
module Network : sig
|
2017-02-28 03:48:22 +04:00
|
|
|
|
2017-02-17 22:12:06 +04:00
|
|
|
val stat : t -> P2p.Stat.t
|
|
|
|
val watch : t -> P2p.RPC.Event.t Lwt_stream.t * Watcher.stopper
|
|
|
|
val connect : t -> P2p.Point.t -> float -> unit tzresult Lwt.t
|
|
|
|
|
|
|
|
module Connection : sig
|
2017-02-24 06:50:33 +04:00
|
|
|
val info : t -> P2p.Peer_id.t -> P2p.Connection_info.t option
|
|
|
|
val kick : t -> P2p.Peer_id.t -> bool -> unit Lwt.t
|
2017-02-17 22:12:06 +04:00
|
|
|
val list : t -> P2p.Connection_info.t list
|
|
|
|
val count : t -> int
|
|
|
|
end
|
|
|
|
|
2017-02-24 06:50:33 +04:00
|
|
|
module Peer_id : sig
|
2017-03-02 18:39:36 +04:00
|
|
|
val list : t ->
|
2017-02-24 06:50:33 +04:00
|
|
|
P2p.RPC.Peer_id.state list -> (P2p.Peer_id.t * P2p.RPC.Peer_id.info) list
|
|
|
|
val info : t -> P2p.Peer_id.t -> P2p.RPC.Peer_id.info option
|
|
|
|
val events : t -> P2p.Peer_id.t -> P2p.RPC.Peer_id.Event.t list
|
|
|
|
val watch : t -> P2p.Peer_id.t ->
|
|
|
|
P2p.RPC.Peer_id.Event.t Lwt_stream.t * Watcher.stopper
|
2017-02-17 22:12:06 +04:00
|
|
|
end
|
|
|
|
|
|
|
|
module Point : sig
|
2017-03-02 18:39:36 +04:00
|
|
|
val list : t ->
|
2017-02-17 22:12:06 +04:00
|
|
|
P2p.RPC.Point.state list -> (P2p.Point.t * P2p.RPC.Point.info) list
|
|
|
|
val info : t -> P2p.Point.t -> P2p.RPC.Point.info option
|
|
|
|
val events : t -> P2p.Point.t -> P2p.RPC.Point.Event.t list
|
|
|
|
val watch : t -> P2p.Point.t ->
|
|
|
|
P2p.RPC.Point.Event.t Lwt_stream.t * Watcher.stopper
|
|
|
|
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
|