Skip to content

Commit

Permalink
list -> slot_list (solana-labs#23355)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffwashington authored Feb 28, 2022
1 parent 186bb19 commit 30dafc7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions runtime/src/in_mem_accounts_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ impl<T: IndexValue> InMemAccountsIndex<T> {
/// or, 'account_info' is appended to the slot list if the slot did not exist previously.
/// returns true if caller should addref
fn update_slot_list(
list: &mut SlotList<T>,
slot_list: &mut SlotList<T>,
slot: Slot,
account_info: T,
_other_slot: Option<Slot>,
Expand All @@ -479,28 +479,28 @@ impl<T: IndexValue> InMemAccountsIndex<T> {
let mut addref = !account_info.is_cached();

// find other dirty entries from the same slot
for list_index in 0..list.len() {
let (s, previous_update_value) = &list[list_index];
for list_index in 0..slot_list.len() {
let (s, previous_update_value) = &slot_list[list_index];
if *s == slot {
let previous_was_cached = previous_update_value.is_cached();
addref = addref && previous_was_cached;

let mut new_item = (slot, account_info);
std::mem::swap(&mut new_item, &mut list[list_index]);
std::mem::swap(&mut new_item, &mut slot_list[list_index]);
if previous_slot_entry_was_cached {
assert!(previous_was_cached);
} else {
reclaims.push(new_item);
}
list[(list_index + 1)..]
slot_list[(list_index + 1)..]
.iter()
.for_each(|item| assert!(item.0 != slot));
return addref;
}
}

// if we make it here, we did not find the slot in the list
list.push((slot, account_info));
slot_list.push((slot, account_info));
addref
}

Expand Down

0 comments on commit 30dafc7

Please sign in to comment.