From 1c81d5830237fc07745fe696ca0020f2b88282d4 Mon Sep 17 00:00:00 2001 From: HaoranYi Date: Thu, 29 Feb 2024 16:45:29 +0000 Subject: [PATCH] fix panic in accumulate lt hash. add TODO for future optimization --- accounts-db/src/accounts_db.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/accounts-db/src/accounts_db.rs b/accounts-db/src/accounts_db.rs index c77e8234b16448..a80b4ae0e6c2cb 100644 --- a/accounts-db/src/accounts_db.rs +++ b/accounts-db/src/accounts_db.rs @@ -8128,12 +8128,13 @@ impl AccountsDb { let old = pubkey_hash .iter() .map(|(k, _)| { - if let Some((account, hash)) = old_written_accounts.get(k) { - Some(hash.unwrap()) // todo on demand calculate, calculate in bg - } else { - self.load_with_fixed_root(&ancestors, k) - .map(|(account, _)| Self::lt_hash_account(&account, k)) - } + /// TODO: add optimization to cache lt_hash from last slot + //if let Some((account, hash)) = old_written_accounts.get(k) { + // Some(hash.unwrap()) // todo on demand calculate, calculate in bg + //} else { + self.load_with_fixed_root(&ancestors, k) + .map(|(account, _)| Self::lt_hash_account(&account, k)) + //} }) .collect::>();