add AccountStorage.is_empty_entry for tests (#29489)
This commit is contained in:
parent
0f2bfa2b02
commit
89deecb979
|
@ -59,6 +59,14 @@ impl AccountStorage {
|
|||
.unwrap_or(true)
|
||||
}
|
||||
|
||||
/// returns true if there is an entry in the map for 'slot', but it contains no append vec
|
||||
#[cfg(test)]
|
||||
pub(crate) fn is_empty_entry(&self, slot: Slot) -> bool {
|
||||
self.get_slot_stores(slot)
|
||||
.map(|storages| storages.read().unwrap().is_empty())
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
/// initialize the storage map to 'all_storages'
|
||||
pub(crate) fn initialize(&mut self, all_storages: AccountStorageMap) {
|
||||
assert!(self.map.is_empty());
|
||||
|
|
|
@ -16509,7 +16509,7 @@ pub mod tests {
|
|||
} else {
|
||||
assert!(db.dirty_stores.is_empty());
|
||||
}
|
||||
assert!(db.get_storages_for_slot(slot).unwrap().is_empty());
|
||||
assert!(db.storage.is_empty_entry(slot));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17538,7 +17538,7 @@ pub mod tests {
|
|||
&mut AncientSlotPubkeys::default(),
|
||||
&mut dropped_roots,
|
||||
);
|
||||
assert!(db.get_storages_for_slot(next_slot).unwrap().is_empty());
|
||||
assert!(db.storage.is_empty_entry(next_slot));
|
||||
// this removes the storages entry completely from the hashmap for 'next_slot'.
|
||||
// Otherwise, we have a zero length vec in that hashmap
|
||||
db.handle_dropped_roots_for_ancient(dropped_roots);
|
||||
|
|
Loading…
Reference in New Issue