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