@@ -6950,8 +6950,7 @@ impl AccountsDb {
6950
6950
.end
6951
6951
.saturating_sub(slots_per_epoch);
6952
6952
6953
- let mut file_name = String::default();
6954
- if (should_cache_hash_data && eligible_for_caching)
6953
+ let file_name = if (should_cache_hash_data && eligible_for_caching)
6955
6954
|| config.store_detailed_debug_info_on_failure
6956
6955
{
6957
6956
let mut load_from_cache = true;
@@ -6972,10 +6971,12 @@ impl AccountsDb {
6972
6971
load_from_cache = false;
6973
6972
break;
6974
6973
}
6975
- let storage_file = sub_storages.first().unwrap().accounts.get_path();
6974
+ let append_vec = sub_storages.first().unwrap();
6975
+ // check written_bytes here. This is necessary for tests and removes a potential for false positives.
6976
+ append_vec.written_bytes().hash(&mut hasher);
6977
+ let storage_file = append_vec.accounts.get_path();
6976
6978
slot.hash(&mut hasher);
6977
6979
storage_file.hash(&mut hasher);
6978
- // check alive_bytes, etc. here?
6979
6980
let amod = std::fs::metadata(storage_file);
6980
6981
if amod.is_err() {
6981
6982
load_from_cache = false;
@@ -6998,7 +6999,7 @@ impl AccountsDb {
6998
6999
// we have a hash value for all the storages in this slot
6999
7000
// so, build a file name:
7000
7001
let hash = hasher.finish();
7001
- file_name = format!(
7002
+ let file_name = format!(
7002
7003
"{}.{}.{}.{}.{}",
7003
7004
start, end_exclusive, bin_range.start, bin_range.end, hash
7004
7005
);
@@ -7018,14 +7019,18 @@ impl AccountsDb {
7018
7019
scanner.set_accum(retval);
7019
7020
7020
7021
// fall through and load normally - we failed to load
7022
+ file_name
7023
+ } else {
7024
+ String::default()
7021
7025
}
7022
7026
} else {
7023
7027
for (slot, sub_storages) in snapshot_storages.iter_range(start..end_exclusive) {
7024
7028
if bin_range.start == 0 && slot < one_epoch_old {
7025
7029
self.update_old_slot_stats(stats, sub_storages);
7026
7030
}
7027
7031
}
7028
- }
7032
+ String::default()
7033
+ };
7029
7034
7030
7035
for (slot, sub_storages) in snapshot_storages.iter_range(start..end_exclusive) {
7031
7036
scanner.set_slot(slot);
@@ -7188,6 +7193,7 @@ impl AccountsDb {
7188
7193
bank_hash_info.snapshot_hash = hash;
7189
7194
}
7190
7195
7196
+ /// scan 'storage', return a vec of 'CacheHashDataFile', one per pass
7191
7197
fn scan_snapshot_stores_with_cache(
7192
7198
&self,
7193
7199
cache_hash_data: &CacheHashData,
@@ -7340,6 +7346,7 @@ impl AccountsDb {
7340
7346
},
7341
7347
};
7342
7348
7349
+ // get raw data by scanning
7343
7350
let result = self.scan_snapshot_stores_with_cache(
7344
7351
&cache_hash_data,
7345
7352
storages,
@@ -7350,6 +7357,7 @@ impl AccountsDb {
7350
7357
hash.filler_account_suffix.as_ref(),
7351
7358
)?;
7352
7359
7360
+ // turn raw data into merkel tree hashes and sum of lamports
7353
7361
let (hash, lamports, for_next_pass) = hash.rest_of_hash_calculation(
7354
7362
result,
7355
7363
&mut stats,
0 commit comments