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.
type candidate = {
hash : Tezos_base.TzPervasives.Block_hash.t;
round_watched : Tezos_protocol_alpha.Protocol.Alpha_context.Round.t;
payload_hash_watched : Tezos_protocol_alpha.Protocol.Block_payload_hash.t;
}
val candidate_encoding : candidate Tezos_base.TzPervasives.Data_encoding.t
type event =
| Prequorum_reached of candidate
* Tezos_protocol_alpha.Protocol.Alpha_context.Kind.preattestation
Tezos_protocol_alpha.Protocol.Alpha_context.operation
list
| Quorum_reached of candidate
* Tezos_protocol_alpha.Protocol.Alpha_context.Kind.attestation
Tezos_protocol_alpha.Protocol.Alpha_context.operation
list
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.
val retrieve_pending_operations :
Tezos_client_alpha.Protocol_client_context.full ->
t ->
unit Tezos_base.TzPervasives.tzresult Lwt.t
val get_current_operations : t -> Operation_pool.pool
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.