From 9f2f2a45cdb17fce4c14e5d776ad83a8379d6a53 Mon Sep 17 00:00:00 2001 From: "Jeff Washington (jwash)" Date: Wed, 20 Jul 2022 10:05:13 -0500 Subject: [PATCH] AcctIdx: ref_count_from_storage remove Arc::clone (#26678) --- runtime/src/accounts_index.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/runtime/src/accounts_index.rs b/runtime/src/accounts_index.rs index 369eb3cf81..3a29216b4a 100644 --- a/runtime/src/accounts_index.rs +++ b/runtime/src/accounts_index.rs @@ -1657,11 +1657,13 @@ impl AccountsIndex { } pub fn ref_count_from_storage(&self, pubkey: &Pubkey) -> RefCount { - if let Some(locked_entry) = self.get_account_read_entry(pubkey) { - locked_entry.ref_count() - } else { - 0 - } + let map = self.get_account_maps_read_lock(pubkey); + map.get_internal(pubkey, |entry| { + ( + false, + entry.map(|entry| entry.ref_count()).unwrap_or_default(), + ) + }) } fn purge_secondary_indexes_by_inner_key<'a>(