From 1f2e9c0086d4d5c2d91b3cc1468f6c1cbf337343 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..1599fee826 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.abort_active_height().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 abort_active_height(&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,