Skip to content

Commit

Permalink
Merge branch 'master' into feature/block-limits-2
Browse files Browse the repository at this point in the history
  • Loading branch information
0xdeafbeef authored Jun 24, 2024
2 parents 51e1256 + 7a174d9 commit 9dcf8ed
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions consensus/src/engine/input_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,16 @@ impl InputBufferData {
let to_drop = self
.data
.iter()
.take_while(|evicted| {
self.data_bytes = self
.data_bytes
.checked_sub(evicted.len())
.expect("decrease buffered data size on eviction");
self.data_bytes > max_data_bytes
.take_while(|front| {
// last call must not change `self`
let take_more = self.data_bytes > max_data_bytes;
if take_more {
self.data_bytes = self
.data_bytes
.checked_sub(front.len())
.expect("decrease buffered data size on eviction");
}
take_more
})
.count();

Expand Down

0 comments on commit 9dcf8ed

Please sign in to comment.