Adds `is_incremental_accounts_hash_feature_enabled` to `AccountsPackage` (#30368)

This commit is contained in:
Brooks 2023-02-20 12:21:38 -05:00 committed by GitHub
parent 069ebb8081
commit a8e07c41fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -14,7 +14,7 @@ use {
},
},
log::*,
solana_sdk::{clock::Slot, sysvar::epoch_schedule::EpochSchedule},
solana_sdk::{clock::Slot, feature_set, sysvar::epoch_schedule::EpochSchedule},
std::{
fs,
path::{Path, PathBuf},
@ -42,6 +42,7 @@ pub struct AccountsPackage {
pub accounts: Arc<Accounts>,
pub epoch_schedule: EpochSchedule,
pub rent_collector: RentCollector,
pub is_incremental_accounts_hash_feature_enabled: bool,
/// Supplemental information needed for snapshots
pub snapshot_info: Option<SupplementalSnapshotInfo>,
@ -148,6 +149,9 @@ impl AccountsPackage {
accounts_hash_for_testing: Option<AccountsHash>,
snapshot_info: Option<SupplementalSnapshotInfo>,
) -> Self {
let is_incremental_accounts_hash_feature_enabled = bank
.feature_set
.is_active(&feature_set::incremental_snapshot_only_incremental_hash_calculation::id());
Self {
package_type,
slot: bank.slot(),
@ -158,6 +162,7 @@ impl AccountsPackage {
accounts: bank.accounts(),
epoch_schedule: *bank.epoch_schedule(),
rent_collector: bank.rent_collector().clone(),
is_incremental_accounts_hash_feature_enabled,
snapshot_info,
enqueued: Instant::now(),
}
@ -176,6 +181,7 @@ impl AccountsPackage {
accounts: Arc::new(Accounts::default_for_tests()),
epoch_schedule: EpochSchedule::default(),
rent_collector: RentCollector::default(),
is_incremental_accounts_hash_feature_enabled: bool::default(),
snapshot_info: Some(SupplementalSnapshotInfo {
snapshot_links: TempDir::new().unwrap(),
archive_format: ArchiveFormat::Tar,