add bank.bank_enable_rehashing_on_accounts_hash (#27768)

This commit is contained in:
Jeff Washington (jwash) 2022-09-14 11:29:23 -07:00 committed by GitHub
parent 9119dc13ec
commit 3a47dfb8e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 5 deletions

View File

@ -208,7 +208,7 @@ impl SnapshotRequestHandler {
rent_collector: snapshot_root_bank.rent_collector(),
store_detailed_debug_info_on_failure: false,
full_snapshot: None,
enable_rehashing: true,
enable_rehashing: snapshot_root_bank.bank_enable_rehashing_on_accounts_hash(),
},
).unwrap();
assert_eq!(previous_hash, this_hash);

View File

@ -5449,6 +5449,13 @@ impl Bank {
}
}
/// If we are skipping rewrites for bank hash, then we don't want to
/// allow accounts hash calculation to rehash anything.
/// We should use whatever hash found for each account as-is.
pub fn bank_enable_rehashing_on_accounts_hash(&self) -> bool {
true // this will be goverened by a feature later
}
/// Collect rent from `accounts`
///
/// This fn is called inside a parallel loop from `collect_rent_in_partition()`. Avoid adding
@ -7107,7 +7114,7 @@ impl Bank {
debug_verify,
self.epoch_schedule(),
&self.rent_collector,
true,
self.bank_enable_rehashing_on_accounts_hash(),
)
}
@ -7171,7 +7178,7 @@ impl Bank {
self.epoch_schedule(),
&self.rent_collector,
is_startup,
true,
self.bank_enable_rehashing_on_accounts_hash(),
);
if total_lamports != self.capitalization() {
datapoint_info!(
@ -7198,7 +7205,7 @@ impl Bank {
self.epoch_schedule(),
&self.rent_collector,
is_startup,
true,
self.bank_enable_rehashing_on_accounts_hash(),
);
}

View File

@ -119,7 +119,7 @@ impl AccountsPackage {
accounts: bank.accounts(),
epoch_schedule: *bank.epoch_schedule(),
rent_collector: bank.rent_collector().clone(),
enable_rehashing: true, // this will be feature driven using bank
enable_rehashing: bank.bank_enable_rehashing_on_accounts_hash(),
})
}
}