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. *)
|
|
|
|
(* *)
|
|
|
|
(**************************************************************************)
|
|
|
|
|
|
|
|
(** The prevalidation worker is in charge of the "mempool" (a.k.a. the
|
|
|
|
set of known not-invalid-for-sure operations that are not yet
|
|
|
|
included in the blockchain).
|
|
|
|
|
|
|
|
The worker also maintains a sorted subset of the mempool that
|
|
|
|
might correspond to a valid block on top of the current head. The
|
|
|
|
"in-progress" context produced by the application of those
|
|
|
|
operations is called the (pre)validation context.
|
|
|
|
|
|
|
|
Before to include an operation into the mempool, the prevalidation
|
|
|
|
worker tries to append the operation the prevalidation context. If
|
|
|
|
the operation is (strongly) refused, it will not be added into the
|
|
|
|
mempool and then it will be ignored by the node and never
|
|
|
|
broadcasted. If the operation is only "branch_refused" or
|
|
|
|
"branch_delayed", the operation won't be appended in the
|
|
|
|
prevalidation context, but still broadcasted.
|
|
|
|
|
|
|
|
*)
|
|
|
|
|
|
|
|
type t
|
|
|
|
|
|
|
|
(** Creation and destruction of a "prevalidation" worker. *)
|
2017-11-13 17:25:02 +04:00
|
|
|
val create:
|
|
|
|
operation_timeout: float ->
|
|
|
|
Distributed_db.net_db -> t Lwt.t
|
2016-09-08 21:13:10 +04:00
|
|
|
val shutdown: t -> unit Lwt.t
|
|
|
|
|
2017-03-04 12:53:44 +04:00
|
|
|
val notify_operations: t -> P2p.Peer_id.t -> Operation_hash.t list -> unit
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
(** Conditionnaly inject a new operation in the node: the operation will
|
|
|
|
be ignored when it is (strongly) refused This is the
|
|
|
|
entry-point used by the P2P layer. The operation content has been
|
|
|
|
previously stored on disk. *)
|
2017-04-19 23:46:10 +04:00
|
|
|
val inject_operation: t -> ?force:bool -> Operation.t -> unit tzresult Lwt.t
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-04-19 23:46:10 +04:00
|
|
|
val flush: t -> State.Block.t -> unit
|
2016-09-08 21:13:10 +04:00
|
|
|
val timestamp: t -> Time.t
|
2016-10-20 20:54:16 +04:00
|
|
|
val operations: t -> error Prevalidation.preapply_result * Operation_hash.Set.t
|
2017-04-10 14:14:11 +04:00
|
|
|
val context: t -> Updater.validation_result tzresult Lwt.t
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-04-19 23:46:10 +04:00
|
|
|
val pending: ?block:State.Block.t -> t -> Operation_hash.Set.t Lwt.t
|