Module Tezos_baking_alpha.Operation_worker

The operation worker is responsible for listening to the node's mempool and collecting incoming operations in an accessible operation pool. Upon request, it can monitor the (pre)quorum status for a given payload and report its completion through the provided quorum stream.

Only one payload quorum or prequorum can be monitored at a time; new monitoring requests override the previous one.

Datatypes

type t

Constructors

val run : ?monitor_node_operations:bool -> Tezos_client_alpha.Protocol_client_context.full -> t Lwt.t

run ?monitor_node_operations cctxt spawns an operation worker.

  • parameter monitor_node_operations

    monitor operations on the node (defaults: true). Set monitor_node_operations to false to only consider externally provided (non-node) operations.

Utilities

Accessors

val get_current_operations : t -> Operation_pool.pool
val get_quorum_event_stream : t -> event Lwt_stream.t

Observers

val monitor_preattestation_quorum : t -> consensus_threshold:int -> get_slot_voting_power: (slot:Tezos_protocol_alpha.Protocol.Alpha_context.Slot.t -> int option) -> candidate -> unit Lwt.t

monitor_preattestation_quorum state threshold get_slot_voting_power candidate Register candidate as the currently monitored payload, overriding any other prequorum or quorum payload. Completion of the prequorum is signaled through the quorum event stream.

val monitor_attestation_quorum : t -> consensus_threshold:int -> get_slot_voting_power: (slot:Tezos_protocol_alpha.Protocol.Alpha_context.Slot.t -> int option) -> candidate -> unit Lwt.t

monitor_attestation_quorum state threshold get_slot_voting_power candidate Register candidate as the currently monitored payload, overriding any other prequorum or quorum payload. Completion of the quorum is signaled through the quorum event stream.

val cancel_monitoring : t -> unit

cancel_monitoring state removes current monitored payload. Does nothing if no payload is being monitored.

val shutdown_worker : t -> (unit, exn list) Stdlib.result Lwt.t

shutdown_worker state closes the monitor_operations stream and removes current monitored payload.