Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: clean up geyser-plugin-manager #1570

Merged
merged 2 commits into from
Jun 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 11 additions & 14 deletions geyser-plugin-manager/src/accounts_update_notifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,9 @@ impl AccountsUpdateNotifierInterface for AccountsUpdateNotifierImpl {
pubkey: &Pubkey,
write_version: u64,
) {
if let Some(account_info) =
self.accountinfo_from_shared_account_data(account, txn, pubkey, write_version)
{
self.notify_plugins_of_account_update(account_info, slot, false);
}
let account_info =
self.accountinfo_from_shared_account_data(account, txn, pubkey, write_version);
self.notify_plugins_of_account_update(account_info, slot, false);
}

fn notify_account_restore_from_snapshot(&self, slot: Slot, account: &StoredAccountMeta) {
Expand All @@ -54,9 +52,8 @@ impl AccountsUpdateNotifierInterface for AccountsUpdateNotifierImpl {
100000
);

if let Some(account_info) = account {
self.notify_plugins_of_account_update(account_info, slot, true);
}
self.notify_plugins_of_account_update(account, slot, true);

measure_all.stop();

inc_new_counter_debug!(
Expand Down Expand Up @@ -110,8 +107,8 @@ impl AccountsUpdateNotifierImpl {
txn: &'a Option<&'a SanitizedTransaction>,
pubkey: &'a Pubkey,
write_version: u64,
) -> Option<ReplicaAccountInfoV3<'a>> {
Some(ReplicaAccountInfoV3 {
) -> ReplicaAccountInfoV3<'a> {
ReplicaAccountInfoV3 {
pubkey: pubkey.as_ref(),
lamports: account.lamports(),
owner: account.owner().as_ref(),
Expand All @@ -120,21 +117,21 @@ impl AccountsUpdateNotifierImpl {
data: account.data(),
write_version,
txn: *txn,
})
}
}

fn accountinfo_from_stored_account_meta<'a>(
&self,
stored_account_meta: &'a StoredAccountMeta,
) -> Option<ReplicaAccountInfoV3<'a>> {
) -> ReplicaAccountInfoV3<'a> {
// We do not need to rely on the specific write_version read from the append vec.
// So, overwrite the write_version with something that works.
// There is already only entry per pubkey.
// write_version is only used to order multiple entries with the same pubkey,
// so it doesn't matter what value it gets here.
// Passing 0 for everyone's write_version is sufficiently correct.
let write_version = 0;
Some(ReplicaAccountInfoV3 {
ReplicaAccountInfoV3 {
pubkey: stored_account_meta.pubkey().as_ref(),
lamports: stored_account_meta.lamports(),
owner: stored_account_meta.owner().as_ref(),
Expand All @@ -143,7 +140,7 @@ impl AccountsUpdateNotifierImpl {
data: stored_account_meta.data(),
write_version,
txn: None,
})
}
}

fn notify_plugins_of_account_update(
Expand Down