Skip to content

Commit

Permalink
fix panic in accumulate lt hash. add TODO for future optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
HaoranYi committed Feb 29, 2024
1 parent 2edc9e2 commit 1c81d58
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions accounts-db/src/accounts_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Vec<_>>();

Expand Down

0 comments on commit 1c81d58

Please sign in to comment.