massa_consensus_exports/
channels.rs

1use massa_channel::sender::MassaSender;
2use massa_execution_exports::ExecutionController;
3use massa_models::block::{FilledBlock, SecureShareBlock};
4use massa_models::block_header::BlockHeader;
5use massa_models::block_id::BlockId;
6use massa_models::secure_share::SecureShare;
7use massa_pool_exports::PoolController;
8use massa_pos_exports::SelectorController;
9use massa_protocol_exports::ProtocolController;
10
11use crate::events::ConsensusEvent;
12
13/// Contains links to other modules of the node to be able to interact with them.
14#[derive(Clone)]
15pub struct ConsensusChannels {
16    /// Interface to interact with Execution module
17    pub execution_controller: Box<dyn ExecutionController>,
18    /// Interface to interact with PoS module
19    pub selector_controller: Box<dyn SelectorController>,
20    /// Interface to interact with Pool module
21    pub pool_controller: Box<dyn PoolController>,
22    /// Interface to interact with Protocol module
23    pub protocol_controller: Box<dyn ProtocolController>,
24    /// Channel used by the consensus to send events to the node globally
25    pub controller_event_tx: MassaSender<ConsensusEvent>,
26    /// Structure used by consensus to broadcast all the information about the blocks
27    pub broadcasts: ConsensusBroadcasts,
28}
29
30/// Structure used to broadcast all the information about the blocks
31#[derive(Clone)]
32pub struct ConsensusBroadcasts {
33    /// Channel used for Websocket broadcast (if enabled) of new blocks being integrated in the graph
34    pub block_sender: tokio::sync::broadcast::Sender<SecureShareBlock>,
35    /// Channel used for Websocket broadcast (if enabled) of new block headers being integrated in the graph
36    pub block_header_sender: tokio::sync::broadcast::Sender<SecureShare<BlockHeader, BlockId>>,
37    /// Channel use by Websocket (if they are enable) to broadcast a new block integrated
38    pub filled_block_sender: tokio::sync::broadcast::Sender<FilledBlock>,
39}