Skip to content

Commit

Permalink
Replace raw subtraction w/ checked_sub (#2418)
Browse files Browse the repository at this point in the history
Co-authored-by: tbro <[email protected]>
  • Loading branch information
tbro and tbro authored Dec 19, 2024
1 parent 419651a commit f68a58e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sequencer/src/api/sql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,9 @@ async fn load_frontier<Mode: TransactionMode>(
) -> anyhow::Result<BlocksFrontier> {
tx.get_path(
Snapshot::<SeqTypes, BlockMerkleTree, { BlockMerkleTree::ARITY }>::Index(height),
height - 1,
height
.checked_sub(1)
.ok_or(anyhow::anyhow!("Subtract with overflow ({height})!"))?,
)
.await
.context(format!("fetching frontier at height {height}"))
Expand Down

0 comments on commit f68a58e

Please sign in to comment.