fix(prune): avoid panic in tx lookup (#21275)

This commit is contained in:
Alexey Shekhirin
2026-01-21 21:21:53 +00:00
committed by GitHub
parent 74edce0089
commit 72e1467ba3

View File

@@ -84,7 +84,14 @@ where
.into_inner();
let tx_range = start..=
Some(end)
.min(input.limiter.deleted_entries_limit_left().map(|left| start + left as u64 - 1))
.min(
input
.limiter
.deleted_entries_limit_left()
// Use saturating addition here to avoid panicking on
// `deleted_entries_limit == usize::MAX`
.map(|left| start.saturating_add(left as u64) - 1),
)
.unwrap();
let tx_range_end = *tx_range.end();