add full_snapshot to hash config (#26811)

This commit is contained in:
Jeff Washington (jwash) 2022-07-28 09:46:34 -05:00 committed by GitHub
parent 2481ebb150
commit 817f65bb50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 0 deletions

View File

@ -142,6 +142,7 @@ impl AccountsHashVerifier {
epoch_schedule: &accounts_package.epoch_schedule,
rent_collector: &accounts_package.rent_collector,
store_detailed_debug_info_on_failure: false,
full_snapshot: None,
},
&sorted_storages,
timings,
@ -164,6 +165,7 @@ impl AccountsHashVerifier {
rent_collector: &accounts_package.rent_collector,
// now that we've failed, store off the failing contents that produced a bad capitalization
store_detailed_debug_info_on_failure: true,
full_snapshot: None,
},
&sorted_storages,
HashStats::default(),

View File

@ -241,6 +241,7 @@ impl SnapshotRequestHandler {
epoch_schedule: snapshot_root_bank.epoch_schedule(),
rent_collector: snapshot_root_bank.rent_collector(),
store_detailed_debug_info_on_failure: false,
full_snapshot: None,
},
).unwrap();
assert_eq!(previous_hash, this_hash);

View File

@ -6742,6 +6742,7 @@ impl AccountsDb {
epoch_schedule,
rent_collector,
store_detailed_debug_info_on_failure: false,
full_snapshot: None,
},
expected_capitalization,
)
@ -7023,6 +7024,7 @@ impl AccountsDb {
epoch_schedule,
rent_collector,
store_detailed_debug_info_on_failure: false,
full_snapshot: None,
},
None,
)?;
@ -11626,6 +11628,7 @@ pub mod tests {
epoch_schedule: &EPOCH_SCHEDULE,
rent_collector: &RENT_COLLECTOR,
store_detailed_debug_info_on_failure: false,
full_snapshot: None,
}
}
}

View File

@ -6,6 +6,7 @@ use {
solana_sdk::{
hash::{Hash, Hasher},
pubkey::Pubkey,
slot_history::Slot,
sysvar::epoch_schedule::EpochSchedule,
},
std::{
@ -27,6 +28,15 @@ pub struct PreviousPass {
pub lamports: u64,
}
#[derive(Debug)]
#[allow(dead_code)]
pub struct FullSnapshotAccountsHashInfo {
/// accounts hash over all accounts when the full snapshot was taken
hash: Hash,
/// slot where full snapshot was taken
slot: Slot,
}
/// parameters to calculate accounts hash
#[derive(Debug)]
pub struct CalcAccountsHashConfig<'a> {
@ -45,6 +55,8 @@ pub struct CalcAccountsHashConfig<'a> {
pub rent_collector: &'a RentCollector,
/// used for tracking down hash mismatches after the fact
pub store_detailed_debug_info_on_failure: bool,
/// `Some` if this is an incremental snapshot which only hashes slots since the base full snapshot
pub full_snapshot: Option<FullSnapshotAccountsHashInfo>,
}
impl<'a> CalcAccountsHashConfig<'a> {