diff --git a/runtime/src/accounts_index.rs b/runtime/src/accounts_index.rs index b6e402e2ae..0acb02aa9f 100644 --- a/runtime/src/accounts_index.rs +++ b/runtime/src/accounts_index.rs @@ -524,7 +524,7 @@ pub struct AccountsIndexRootsStats { } pub struct AccountsIndexIterator<'a, T> { - account_maps: &'a RwLock>>, + account_maps: &'a LockMapType, start_bound: Bound, end_bound: Bound, is_finished: bool, @@ -539,10 +539,7 @@ impl<'a, T> AccountsIndexIterator<'a, T> { } } - pub fn new( - account_maps: &'a RwLock>>, - range: Option, - ) -> Self + pub fn new(account_maps: &'a LockMapType, range: Option) -> Self where R: RangeBounds, { @@ -592,8 +589,9 @@ pub trait ZeroLamport { } type MapType = AccountMap>; -type AccountMapsWriteLock<'a, T> = RwLockWriteGuard<'a, AccountMap>>; -type AccountMapsReadLock<'a, T> = RwLockReadGuard<'a, AccountMap>>; +type LockMapType = RwLock>; +type AccountMapsWriteLock<'a, T> = RwLockWriteGuard<'a, MapType>; +type AccountMapsReadLock<'a, T> = RwLockReadGuard<'a, MapType>; #[derive(Debug, Default)] pub struct ScanSlotTracker { @@ -613,7 +611,7 @@ impl ScanSlotTracker { #[derive(Debug)] pub struct AccountsIndex { - pub account_maps: RwLock>, + pub account_maps: LockMapType, program_id_index: SecondaryIndex, spl_token_mint_index: SecondaryIndex, spl_token_owner_index: SecondaryIndex, @@ -636,7 +634,7 @@ pub struct AccountsIndex { impl Default for AccountsIndex { fn default() -> Self { Self { - account_maps: RwLock::>>::default(), + account_maps: LockMapType::::default(), program_id_index: SecondaryIndex::::new( "program_id_index_stats", ),