diff --git a/accounts-db/src/accounts_db.rs b/accounts-db/src/accounts_db.rs index 2684c44b9373b9..53b8d1346ba2ec 100644 --- a/accounts-db/src/accounts_db.rs +++ b/accounts-db/src/accounts_db.rs @@ -7607,7 +7607,10 @@ impl AccountsDb { Some((*loaded_account.pubkey(), loaded_account.loaded_hash())) }, |accum: &DashMap, loaded_account: LoadedAccount| { - let loaded_hash = loaded_account.loaded_hash(); + let mut loaded_hash = loaded_account.loaded_hash(); + if loaded_hash == AccountHash(Hash::default()) { + loaded_hash = Self::hash_account(&loaded_account, loaded_account.pubkey()) + } accum.insert(*loaded_account.pubkey(), loaded_hash); }, ); @@ -7639,9 +7642,13 @@ impl AccountsDb { |accum: &DashMap, loaded_account: LoadedAccount| { // Storage may have duplicates so only keep the latest version for each key + let mut loaded_hash = loaded_account.loaded_hash(); + if loaded_hash == AccountHash(Hash::default()) { + loaded_hash = Self::hash_account(&loaded_account, loaded_account.pubkey()) + } accum.insert( *loaded_account.pubkey(), - (loaded_account.loaded_hash(), loaded_account.take_account()), + (loaded_hash, loaded_account.take_account()), ); }, );