From 0ff701d5e3ed803ed4322589457b46f2135a67a4 Mon Sep 17 00:00:00 2001 From: Alon-Lukatch-Starkware Date: Sun, 27 Oct 2024 11:58:38 +0200 Subject: [PATCH] fix(mempool): mempool will not propagate declare transactions (#932) * refactor(mempool): add mempool p2p sender client to mempool communication wrapper * fix(mempool): mempool will not propagate declare transactions --- crates/mempool/src/communication.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/mempool/src/communication.rs b/crates/mempool/src/communication.rs index d02f08b750..3817e27fad 100644 --- a/crates/mempool/src/communication.rs +++ b/crates/mempool/src/communication.rs @@ -50,7 +50,7 @@ impl MempoolCommunicationWrapper { &self, message_metadata: Option, tx: Transaction, - ) -> Result<(), MempoolError> { + ) -> MempoolResult<()> { match message_metadata { Some(message_metadata) => self .mempool_p2p_propagator_client @@ -67,7 +67,11 @@ impl MempoolCommunicationWrapper { async fn add_tx(&mut self, args_wrapper: AddTransactionArgsWrapper) -> MempoolResult<()> { self.mempool.add_tx(args_wrapper.args.clone())?; // TODO: Verify that only transactions that were added to the mempool are sent. - self.send_tx_to_p2p(args_wrapper.p2p_message_metadata, args_wrapper.args.tx).await + // TODO: handle declare correctly and remove this match. + match args_wrapper.args.tx { + Transaction::Declare(_) => Ok(()), + _ => self.send_tx_to_p2p(args_wrapper.p2p_message_metadata, args_wrapper.args.tx).await, + } } fn commit_block(&mut self, args: CommitBlockArgs) -> MempoolResult<()> {