From 49259dcad8c184dc4a9c5a592451585e2e6055ab Mon Sep 17 00:00:00 2001 From: "Jeff Washington (jwash)" Date: Wed, 24 May 2023 12:51:03 -0500 Subject: [PATCH] add optional ignore to `calculate_accounts_delta_hash` (#31801) --- runtime/src/accounts_db.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/runtime/src/accounts_db.rs b/runtime/src/accounts_db.rs index 166f78ec9..c6ebaa572 100644 --- a/runtime/src/accounts_db.rs +++ b/runtime/src/accounts_db.rs @@ -7772,8 +7772,23 @@ impl AccountsDb { /// As part of calculating the accounts delta hash, get a list of accounts modified this slot /// (aka dirty pubkeys) and add them to `self.uncleaned_pubkeys` for future cleaning. pub fn calculate_accounts_delta_hash(&self, slot: Slot) -> AccountsDeltaHash { + self.calculate_accounts_delta_hash_internal(slot, None) + } + + /// Calculate accounts delta hash for `slot` + /// + /// As part of calculating the accounts delta hash, get a list of accounts modified this slot + /// (aka dirty pubkeys) and add them to `self.uncleaned_pubkeys` for future cleaning. + pub(crate) fn calculate_accounts_delta_hash_internal( + &self, + slot: Slot, + ignore: Option, + ) -> AccountsDeltaHash { let (mut hashes, scan_us, mut accumulate) = self.get_pubkey_hash_for_slot(slot); let dirty_keys = hashes.iter().map(|(pubkey, _hash)| *pubkey).collect(); + if let Some(ignore) = ignore { + hashes.retain(|k| k.0 != ignore); + } if self.filler_accounts_enabled() { // filler accounts must be added to 'dirty_keys' above but cannot be used to calculate hash