diff --git a/crates/starknet_sequencer_node/src/clients.rs b/crates/starknet_sequencer_node/src/clients.rs index 96919fbd0a..4ef7440f01 100644 --- a/crates/starknet_sequencer_node/src/clients.rs +++ b/crates/starknet_sequencer_node/src/clients.rs @@ -28,7 +28,7 @@ use starknet_mempool_types::communication::{ RemoteMempoolClient, SharedMempoolClient, }; -use starknet_sequencer_infra::component_client::Client; +use starknet_sequencer_infra::component_client::{Client, LocalComponentClient}; use crate::communication::SequencerNodeCommunication; use crate::config::component_execution_config::ComponentExecutionMode; @@ -92,24 +92,62 @@ macro_rules! get_shared_client { }}; } +// TODO(Nadin): Refactor getters to remove code duplication. impl SequencerNodeClients { pub fn get_batcher_shared_client(&self) -> Option { get_shared_client!(self, batcher_client) } + pub fn get_batcher_local_client( + &self, + ) -> Option> { + match &self.batcher_client { + Some(client) => client.get_local_client(), + None => None, + } + } + pub fn get_mempool_shared_client(&self) -> Option { get_shared_client!(self, mempool_client) } + pub fn get_mempool_local_client( + &self, + ) -> Option> { + match &self.mempool_client { + Some(client) => client.get_local_client(), + None => None, + } + } + pub fn get_gateway_shared_client(&self) -> Option { get_shared_client!(self, gateway_client) } + pub fn get_gateway_local_client( + &self, + ) -> Option> { + match &self.gateway_client { + Some(client) => client.get_local_client(), + None => None, + } + } + pub fn get_mempool_p2p_propagator_shared_client( &self, ) -> Option { get_shared_client!(self, mempool_p2p_propagator_client) } + + pub fn get_mempool_p2p_propagator_local_client( + &self, + ) -> Option> + { + match &self.mempool_p2p_propagator_client { + Some(client) => client.get_local_client(), + None => None, + } + } } /// A macro for creating a component client, determined by the component's execution mode. Returns a