diff --git a/runtime/src/accounts_index.rs b/runtime/src/accounts_index.rs index b2b80f108d..5f8579f9c4 100644 --- a/runtime/src/accounts_index.rs +++ b/runtime/src/accounts_index.rs @@ -42,22 +42,10 @@ pub type AccountMap = BTreeMap; type AccountMapEntry = Arc>; -pub trait IsCached: 'static + Clone + Debug { +pub trait IsCached: 'static + Clone + Debug + PartialEq + ZeroLamport { fn is_cached(&self) -> bool; } -impl IsCached for bool { - fn is_cached(&self) -> bool { - false - } -} - -impl IsCached for u64 { - fn is_cached(&self) -> bool { - false - } -} - #[derive(Error, Debug, PartialEq)] pub enum ScanError { #[error("Node detected it replayed bad version of slot {slot:?} with id {bank_id:?}, thus the scan on said slot was aborted")] @@ -170,7 +158,7 @@ pub struct WriteAccountMapEntry { slot_list_guard: RwLockWriteGuard<'this, SlotList>, } -impl WriteAccountMapEntry { +impl WriteAccountMapEntry { pub fn from_account_map_entry(account_map_entry: AccountMapEntry) -> Self { WriteAccountMapEntryBuilder { owned_entry: account_map_entry, @@ -741,10 +729,7 @@ pub struct AccountsIndex { pub removed_bank_ids: Mutex>, } -impl< - T: 'static + Clone + IsCached + ZeroLamport + std::marker::Sync + std::marker::Send + Debug, - > AccountsIndex -{ +impl AccountsIndex { pub fn default_for_tests() -> Self { Self::new(BINS_FOR_TESTING) } @@ -2728,16 +2713,7 @@ pub mod tests { } } - fn test_new_entry_code_paths_helper< - T: 'static - + Sync - + Send - + Clone - + IsCached - + ZeroLamport - + std::cmp::PartialEq - + std::fmt::Debug, - >( + fn test_new_entry_code_paths_helper( account_infos: [T; 2], is_cached: bool, upsert: bool, @@ -3375,18 +3351,7 @@ pub mod tests { assert!(found_key); } - fn account_maps_len_expensive< - T: 'static - + Sync - + Send - + Clone - + IsCached - + ZeroLamport - + std::cmp::PartialEq - + std::fmt::Debug, - >( - index: &AccountsIndex, - ) -> usize { + fn account_maps_len_expensive(index: &AccountsIndex) -> usize { index .account_maps .iter() @@ -3905,6 +3870,16 @@ pub mod tests { ); } + impl IsCached for bool { + fn is_cached(&self) -> bool { + false + } + } + impl IsCached for u64 { + fn is_cached(&self) -> bool { + false + } + } impl ZeroLamport for bool { fn is_zero_lamport(&self) -> bool { false