diff --git a/crates/storage/provider/src/providers/static_file/manager.rs b/crates/storage/provider/src/providers/static_file/manager.rs index 930eec1feea3..1c045b9be49a 100644 --- a/crates/storage/provider/src/providers/static_file/manager.rs +++ b/crates/storage/provider/src/providers/static_file/manager.rs @@ -534,14 +534,14 @@ impl StaticFileProvider { .or_insert_with(|| BTreeMap::from([(tx_end, current_block_range)])); } } else if segment.is_tx_based() { - // The unwound file has no more transactions/receipts. However, the tip is part - // of this files' block range. We only retain entries with - // block ranges before the current one. + // The unwinded file has no more transactions/receipts. However, the highest + // block is within this files' block range. We only retain + // entries with block ranges before the current one. tx_index.entry(segment).and_modify(|index| { index.retain(|_, block_range| block_range.start() < fixed_range.start()); }); - // If the segment index is empty, just remove it. + // If the index is empty, just remove it. if tx_index.get(&segment).is_some_and(|index| index.is_empty()) { tx_index.remove(&segment); } diff --git a/crates/storage/provider/src/providers/static_file/mod.rs b/crates/storage/provider/src/providers/static_file/mod.rs index f6d9f310e26f..25c5ec7ef6aa 100644 --- a/crates/storage/provider/src/providers/static_file/mod.rs +++ b/crates/storage/provider/src/providers/static_file/mod.rs @@ -510,9 +510,9 @@ mod tests { 0, blocks_per_file - 1, Some(highest_tx - 1), - files_per_range + 1, + files_per_range + 1, // includes lockfile vec![(highest_tx - 1, SegmentRangeInclusive::new(0, 9))], - ), /* includes lockfile */ + ), // Case 2: Prune most txs up to block 1. ( highest_tx - 1,