@ -1376,9 +1376,11 @@ impl AccountsDB {
|
|||||||
let index = self.accounts_index.read().unwrap();
|
let index = self.accounts_index.read().unwrap();
|
||||||
let storage = self.storage.read().unwrap();
|
let storage = self.storage.read().unwrap();
|
||||||
for slot in dead_slots.iter() {
|
for slot in dead_slots.iter() {
|
||||||
for store in storage.0.get(slot).unwrap().values() {
|
if let Some(slot_storage) = storage.0.get(slot) {
|
||||||
for account in store.accounts.accounts(0) {
|
for store in slot_storage.values() {
|
||||||
index.unref_from_storage(&account.meta.pubkey);
|
for account in store.accounts.accounts(0) {
|
||||||
|
index.unref_from_storage(&account.meta.pubkey);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3373,4 +3375,12 @@ pub mod tests {
|
|||||||
assert_load_account(&accounts, current_slot, pubkey2, old_lamport);
|
assert_load_account(&accounts, current_slot, pubkey2, old_lamport);
|
||||||
assert_load_account(&accounts, current_slot, dummy_pubkey, dummy_lamport);
|
assert_load_account(&accounts, current_slot, dummy_pubkey, dummy_lamport);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn clean_dead_slots_empty() {
|
||||||
|
let accounts = AccountsDB::new_single();
|
||||||
|
let mut dead_slots = HashSet::new();
|
||||||
|
dead_slots.insert(10);
|
||||||
|
accounts.clean_dead_slots(&mut dead_slots);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user