Skip to content

Commit 969fa3b

Browse files
committed
fix subtract with overflow in relative_min_window_density() consensus.rs
1 parent e33ce80 commit 969fa3b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

.idea/vcs.xml

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/src/consensus.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,9 @@ pub fn relative_min_window_density(b1: &MinaConsensusState, b2: &MinaConsensusSt
7575

7676
let projected_window = {
7777
// Compute shift count
78-
let shift_count =
79-
(max_slot.saturating_sub(global_slot(b1) + 1)).clamp(0, SUB_WINDOWS_PER_WINDOW);
78+
let shift_count = max_slot
79+
.saturating_sub(global_slot(b1) + 1)
80+
.min(SUB_WINDOWS_PER_WINDOW);
8081

8182
// Initialize projected window
8283
let mut projected_window = b1

0 commit comments

Comments
 (0)