From 904b2a76726cd250b08cb35a1bfb247d03936f8a Mon Sep 17 00:00:00 2001 From: Tao Zhu <82401714+taozhu-chicago@users.noreply.github.com> Date: Wed, 6 Sep 2023 09:58:58 -0500 Subject: [PATCH] finalize prioritization_fee_cache after oc-ed bank is frozen (#33100) --- rpc/src/optimistically_confirmed_bank_tracker.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/rpc/src/optimistically_confirmed_bank_tracker.rs b/rpc/src/optimistically_confirmed_bank_tracker.rs index 272dbc6b657cb8..3d3643b44a1050 100644 --- a/rpc/src/optimistically_confirmed_bank_tracker.rs +++ b/rpc/src/optimistically_confirmed_bank_tracker.rs @@ -181,6 +181,7 @@ impl OptimisticallyConfirmedBankTracker { last_notified_confirmed_slot: &mut Slot, pending_optimistically_confirmed_banks: &mut HashSet, slot_notification_subscribers: &Option>>>, + prioritization_fee_cache: &PrioritizationFeeCache, ) { if bank.is_frozen() { if bank.slot() > *last_notified_confirmed_slot { @@ -194,6 +195,9 @@ impl OptimisticallyConfirmedBankTracker { slot_notification_subscribers, SlotNotification::OptimisticallyConfirmed(bank.slot()), ); + + // finalize block's minimum prioritization fee cache for this bank + prioritization_fee_cache.finalize_priority_fee(bank.slot()); } } else if bank.slot() > bank_forks.read().unwrap().root() { pending_optimistically_confirmed_banks.insert(bank.slot()); @@ -209,6 +213,7 @@ impl OptimisticallyConfirmedBankTracker { last_notified_confirmed_slot: &mut Slot, pending_optimistically_confirmed_banks: &mut HashSet, slot_notification_subscribers: &Option>>>, + prioritization_fee_cache: &PrioritizationFeeCache, ) { for confirmed_bank in bank.parents_inclusive().iter().rev() { if confirmed_bank.slot() > slot_threshold { @@ -223,6 +228,7 @@ impl OptimisticallyConfirmedBankTracker { last_notified_confirmed_slot, pending_optimistically_confirmed_banks, slot_notification_subscribers, + prioritization_fee_cache, ); } } @@ -291,6 +297,7 @@ impl OptimisticallyConfirmedBankTracker { last_notified_confirmed_slot, pending_optimistically_confirmed_banks, slot_notification_subscribers, + prioritization_fee_cache, ); *highest_confirmed_slot = slot; @@ -307,9 +314,6 @@ impl OptimisticallyConfirmedBankTracker { slot, timestamp: timestamp(), }); - - // finalize block's minimum prioritization fee cache for this bank - prioritization_fee_cache.finalize_priority_fee(slot); } BankNotification::Frozen(bank) => { let frozen_slot = bank.slot(); @@ -348,6 +352,7 @@ impl OptimisticallyConfirmedBankTracker { last_notified_confirmed_slot, pending_optimistically_confirmed_banks, slot_notification_subscribers, + prioritization_fee_cache, ); let mut w_optimistically_confirmed_bank =