Skip to content

Commit

Permalink
fix: potential overflow (#5759)
Browse files Browse the repository at this point in the history
Description
---
Stops a potential overflow in a log

Motivation and Context
---
Overflow should not be possible
  • Loading branch information
SWvheerden committed Sep 12, 2023
1 parent 1eeb4a9 commit 5c93e35
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -116,7 +116,7 @@ impl HeaderSyncState {

let local_nci = shared.local_node_interface.clone();
synchronizer.on_rewind(move |removed| {
if let Some(fork_height) = removed.last().map(|b| b.height() - 1) {
if let Some(fork_height) = removed.last().map(|b| b.height().saturating_sub(1)) {
metrics::tip_height().set(fork_height as i64);
metrics::reorg(fork_height, 0, removed.len()).inc();
}
Expand Down

0 comments on commit 5c93e35

Please sign in to comment.