From d1790d9ae13fbf22e4254b6afd1d26fc9bf7e9ae Mon Sep 17 00:00:00 2001 From: Arni Hod Date: Sun, 15 Dec 2024 14:36:01 +0200 Subject: [PATCH] refactor(starknet_batcher): create method clear previous proposals for code dedup --- crates/starknet_batcher/src/batcher.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/crates/starknet_batcher/src/batcher.rs b/crates/starknet_batcher/src/batcher.rs index b95b945c9b..239ac75e47 100644 --- a/crates/starknet_batcher/src/batcher.rs +++ b/crates/starknet_batcher/src/batcher.rs @@ -112,10 +112,7 @@ impl Batcher { }); } - // Clear all the proposals from the previous height. - self.proposal_manager.reset().await; - self.propose_tx_streams.clear(); - self.validate_tx_streams.clear(); + self.clear_previous_proposals().await; info!("Starting to work on height {}.", input.height); self.active_height = Some(input.height); @@ -234,6 +231,13 @@ impl Batcher { } } + /// Clear all the proposals from the previous height. + async fn clear_previous_proposals(&mut self) { + self.proposal_manager.reset().await; + self.propose_tx_streams.clear(); + self.validate_tx_streams.clear(); + } + async fn handle_send_txs_request( &mut self, proposal_id: ProposalId,