reuse shared function (#27642)

This commit is contained in:
Jeff Washington (jwash) 2022-09-07 13:11:00 -07:00 committed by GitHub
parent c04747dd66
commit d3ca364e9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 13 deletions

View File

@ -2285,19 +2285,6 @@ impl Bank {
bank
}
/// if we were to serialize THIS bank, what value should be saved for the prior accounts hash?
/// This depends on the proximity to the time to take the snapshot and the time to use the snapshot.
pub(crate) fn get_epoch_accounts_hash_to_serialize(&self) -> Option<Hash> {
self.rc
.accounts
.accounts_db
.epoch_accounts_hash
.lock()
.unwrap()
.as_ref()
.map(|hash| *hash.as_ref())
}
/// Return subset of bank fields representing serializable state
pub(crate) fn get_fields_to_serialize<'a>(
&'a self,
@ -7893,6 +7880,12 @@ impl Bank {
total_accounts_stats
}
/// if we were to serialize THIS bank, what value should be saved for the prior accounts hash?
/// This depends on the proximity to the time to take the snapshot and the time to use the snapshot.
pub(crate) fn get_epoch_accounts_hash_to_serialize(&self) -> Option<Hash> {
self.epoch_accounts_hash().map(|hash| *hash.as_ref())
}
/// Convenience fn to get the Epoch Accounts Hash
fn epoch_accounts_hash(&self) -> Option<EpochAccountsHash> {
*self