Skip to content

Commit

Permalink
Removes hash param from AccountsCache::store() (solana-labs#33598)
Browse files Browse the repository at this point in the history
  • Loading branch information
brooksprumo authored Oct 9, 2023
1 parent 2d5496a commit c924719
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
9 changes: 2 additions & 7 deletions accounts-db/src/accounts_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use {
pubkey::Pubkey,
},
std::{
borrow::Borrow,
collections::BTreeSet,
ops::Deref,
sync::{
Expand Down Expand Up @@ -70,14 +69,13 @@ impl SlotCacheInner {
&self,
pubkey: &Pubkey,
account: AccountSharedData,
hash: Option<impl Borrow<Hash>>,
slot: Slot,
include_slot_in_hash: IncludeSlotInHash,
) -> CachedAccount {
let data_len = account.data().len() as u64;
let item = Arc::new(CachedAccountInner {
account,
hash: RwLock::new(hash.map(|h| *h.borrow())),
hash: RwLock::new(None),
slot,
pubkey: *pubkey,
include_slot_in_hash,
Expand Down Expand Up @@ -233,7 +231,6 @@ impl AccountsCache {
slot: Slot,
pubkey: &Pubkey,
account: AccountSharedData,
hash: Option<impl Borrow<Hash>>,
include_slot_in_hash: IncludeSlotInHash,
) -> CachedAccount {
let slot_cache = self.slot_cache(slot).unwrap_or_else(||
Expand All @@ -247,7 +244,7 @@ impl AccountsCache {
.or_insert(self.new_inner())
.clone());

slot_cache.insert(pubkey, account, hash, slot, include_slot_in_hash)
slot_cache.insert(pubkey, account, slot, include_slot_in_hash)
}

pub fn load(&self, slot: Slot, pubkey: &Pubkey) -> Option<CachedAccount> {
Expand Down Expand Up @@ -351,7 +348,6 @@ pub mod tests {
inserted_slot,
&Pubkey::new_unique(),
AccountSharedData::new(1, 0, &Pubkey::default()),
Some(&Hash::default()),
INCLUDE_SLOT_IN_HASH_TESTS,
);
// If the cache is told the size limit is 0, it should return the one slot
Expand All @@ -370,7 +366,6 @@ pub mod tests {
inserted_slot,
&Pubkey::new_unique(),
AccountSharedData::new(1, 0, &Pubkey::default()),
Some(&Hash::default()),
INCLUDE_SLOT_IN_HASH_TESTS,
);

Expand Down
1 change: 0 additions & 1 deletion accounts-db/src/accounts_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6775,7 +6775,6 @@ impl AccountsDb {
slot,
accounts_and_meta_to_store.pubkey(i),
account,
None::<&Hash>,
include_slot_in_hash,
);
// hash this account in the bg
Expand Down

0 comments on commit c924719

Please sign in to comment.