From e5354bc2d14c2b5bfa296fd5869d1c42f2f540f6 Mon Sep 17 00:00:00 2001 From: hkey <81494947+hkey0@users.noreply.github.com> Date: Mon, 10 Jun 2024 10:40:19 +0300 Subject: [PATCH] refactor(sequencer.rs): use if let instead of match (#677) --- crates/sequencer/src/sequencer.rs | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/crates/sequencer/src/sequencer.rs b/crates/sequencer/src/sequencer.rs index d97cf226a..4075e0e1b 100644 --- a/crates/sequencer/src/sequencer.rs +++ b/crates/sequencer/src/sequencer.rs @@ -1000,21 +1000,18 @@ where let commitment = pg_connector.get_last_commitment().await?; // check if last commitment in db matches sequencer's last commitment - match commitment { - Some(db_commitment) => { - // this means that the last commitment in the db is not the same as the sequencer's last commitment - if db_commitment.l1_end_height as u64 - > ledger_commitment_l1_height.unwrap_or(SlotNumber(0)).0 - { - self.ledger_db - .set_last_sequencer_commitment_l1_height(SlotNumber( - db_commitment.l1_end_height as u64, - ))? - } - Ok(()) + if let Some(db_commitment) = commitment { + // this means that the last commitment in the db is not the same as the sequencer's last commitment + if db_commitment.l1_end_height as u64 + > ledger_commitment_l1_height.unwrap_or(SlotNumber(0)).0 + { + self.ledger_db + .set_last_sequencer_commitment_l1_height(SlotNumber( + db_commitment.l1_end_height as u64, + ))? } - None => Ok(()), } + Ok(()) } async fn maybe_submit_commitment(