Skip to content

Commit

Permalink
refactor(sequencer.rs): use if let instead of match (#677)
Browse files Browse the repository at this point in the history
  • Loading branch information
hkey0 authored Jun 10, 2024
1 parent 5441079 commit e5354bc
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions crates/sequencer/src/sequencer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit e5354bc

Please sign in to comment.