diff --git a/accounts-db/src/accounts_db/geyser_plugin_utils.rs b/accounts-db/src/accounts_db/geyser_plugin_utils.rs index 341cd3dd82486d..8dbba07aa3ca44 100644 --- a/accounts-db/src/accounts_db/geyser_plugin_utils.rs +++ b/accounts-db/src/accounts_db/geyser_plugin_utils.rs @@ -39,22 +39,24 @@ impl AccountsDb { /// in the reverse order of the slots so that an account is only streamed once. At a slot, if the accounts is updated /// multiple times only the last write (with highest write_version) is notified. pub fn notify_account_restore_from_snapshot(&self) { - if let Some(accounts_update_notifier) = &self.accounts_update_notifier { - if accounts_update_notifier.notify_snapshot_disabled() { - accounts_update_notifier.notify_end_of_restore_from_snapshot(); - } else { - let mut slots = self.storage.all_slots(); - let mut notified_accounts: HashSet = HashSet::default(); - let mut notify_stats = GeyserPluginNotifyAtSnapshotRestoreStats::default(); - - slots.sort_by(|a, b| b.cmp(a)); - for slot in slots { - self.notify_accounts_in_slot(slot, &mut notified_accounts, &mut notify_stats); - } - - accounts_update_notifier.notify_end_of_restore_from_snapshot(); - notify_stats.report(); + let Some(accounts_update_notifier) = &self.accounts_update_notifier else { + return; + }; + + if accounts_update_notifier.notify_snapshot_disabled() { + accounts_update_notifier.notify_end_of_restore_from_snapshot(); + } else { + let mut slots = self.storage.all_slots(); + let mut notified_accounts: HashSet = HashSet::default(); + let mut notify_stats = GeyserPluginNotifyAtSnapshotRestoreStats::default(); + + slots.sort_by(|a, b| b.cmp(a)); + for slot in slots { + self.notify_accounts_in_slot(slot, &mut notified_accounts, &mut notify_stats); } + + accounts_update_notifier.notify_end_of_restore_from_snapshot(); + notify_stats.report(); } }