Skip to content

Commit

Permalink
comment
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffwashington committed May 17, 2021
1 parent d9fe445 commit 98a30de
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
30 changes: 19 additions & 11 deletions runtime/src/accounts_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5035,17 +5035,25 @@ impl AccountsDb {
accounts_map.iter().map(|(pubkey, _info)| *pubkey).collect();
self.uncleaned_pubkeys.insert(*slot, dirty_keys);

let infos: Vec<_> = accounts_map.iter().map(|(pubkey, account_infos)| {
account_infos.iter().map(|(_, (store_id, stored_account))| {
(pubkey, AccountInfo {
store_id: *store_id,
offset: stored_account.offset,
stored_size: stored_account.stored_size,
lamports: stored_account.account_meta.lamports,
})
}).collect::<Vec<_>>()
}).collect();

let infos: Vec<_> = accounts_map
.iter()
.map(|(pubkey, account_infos)| {
account_infos
.iter()
.map(|(_, (store_id, stored_account))| {
(
pubkey,
AccountInfo {
store_id: *store_id,
offset: stored_account.offset,
stored_size: stored_account.stored_size,
lamports: stored_account.account_meta.lamports,
},
)
})
.collect::<Vec<_>>()
})
.collect();
let mut lock = self.accounts_index.get_account_maps_write_lock();
infos.into_iter().for_each(|item| {
item.into_iter().for_each(|(pubkey, account_info)| {
Expand Down
4 changes: 3 additions & 1 deletion runtime/src/accounts_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1172,6 +1172,7 @@ impl<T: 'static + Clone + IsCached + ZeroLamport> AccountsIndex<T> {
reclaims: &mut SlotList<T>,
w_account_maps: &mut ReadWriteLockMapType<T>,
) {
// assume not in cache
let mut is_newly_inserted = false;
let account_entry = w_account_maps.entry(*pubkey).or_insert_with(|| {
is_newly_inserted = true;
Expand All @@ -1184,7 +1185,8 @@ impl<T: 'static + Clone + IsCached + ZeroLamport> AccountsIndex<T> {
self.zero_lamport_pubkeys.insert(*pubkey);
}
if !is_newly_inserted {
let mut w_account_entry = WriteAccountMapEntry::from_account_map_entry(account_entry.clone());
let mut w_account_entry =
WriteAccountMapEntry::from_account_map_entry(account_entry.clone());
w_account_entry.update(slot, account_info, reclaims);
}
}
Expand Down

0 comments on commit 98a30de

Please sign in to comment.