diff --git a/runtime/src/accounts_db.rs b/runtime/src/accounts_db.rs index 02f28e571e1a85..491435dfd2ffcb 100644 --- a/runtime/src/accounts_db.rs +++ b/runtime/src/accounts_db.rs @@ -1199,11 +1199,13 @@ impl RecycleStores { } fn add_entries(&mut self, new_entries: SnapshotStorage) { - self.total_bytes += new_entries.iter().map(|e| e.total_bytes()).sum::(); + let mut total_bytes = 0; let now = Instant::now(); for new_entry in new_entries { + total_bytes += new_entry.total_bytes(); self.entries.push((now, new_entry)); } + self.total_bytes += total_bytes; } fn expire_old_entries(&mut self) -> SnapshotStorage {