Skip to content

Commit

Permalink
fix(mempool): mempool will not propagate declare transactions (#932)
Browse files Browse the repository at this point in the history
* refactor(mempool): add mempool p2p sender client to mempool communication wrapper

* fix(mempool): mempool will not propagate declare transactions
  • Loading branch information
AlonLStarkWare authored Oct 27, 2024
1 parent b7f8ed7 commit 0ff701d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions crates/mempool/src/communication.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl MempoolCommunicationWrapper {
&self,
message_metadata: Option<BroadcastedMessageMetadata>,
tx: Transaction,
) -> Result<(), MempoolError> {
) -> MempoolResult<()> {
match message_metadata {
Some(message_metadata) => self
.mempool_p2p_propagator_client
Expand All @@ -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<()> {
Expand Down

0 comments on commit 0ff701d

Please sign in to comment.