diff --git a/accounts-db/src/accounts_db.rs b/accounts-db/src/accounts_db.rs index 73d47a5028fca4..b77a1565659c64 100644 --- a/accounts-db/src/accounts_db.rs +++ b/accounts-db/src/accounts_db.rs @@ -8156,14 +8156,17 @@ impl AccountsDb { let old = pubkeys .iter() .map(|k| { - if let Some((_account, hash)) = r_written_accounts_before.get(k) { + if let Some((account, hash)) = r_written_accounts_before.get(k) { // Get old `lt_hash` from cache of writes in parent slots - cache_hits += 1; - Some(hash.unwrap()) // TODO on demand calculate, calculate in bg - } else { - self.load_with_fixed_root(&old_ancestors, k) - .map(|(account, _)| Self::lt_hash_account(&account, k)) + if let Some(hash) = hash { + cache_hits += 1; + return Some(*hash); // TODO on demand calculate, calculate in bg + } else { + warn!("Expect in lt hash cache {} {:?} {:?}", k, account, hash); + } } + self.load_with_fixed_root(&old_ancestors, k) + .map(|(account, _)| Self::lt_hash_account(&account, k)) }) .collect::>(); drop(r_written_accounts_before);