Skip to content

Commit

Permalink
finalize prioritization_fee_cache after oc-ed bank is frozen (#33100)
Browse files Browse the repository at this point in the history
  • Loading branch information
tao-stones authored Sep 6, 2023
1 parent 224eea4 commit 904b2a7
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions rpc/src/optimistically_confirmed_bank_tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ impl OptimisticallyConfirmedBankTracker {
last_notified_confirmed_slot: &mut Slot,
pending_optimistically_confirmed_banks: &mut HashSet<Slot>,
slot_notification_subscribers: &Option<Arc<RwLock<Vec<SlotNotificationSender>>>>,
prioritization_fee_cache: &PrioritizationFeeCache,
) {
if bank.is_frozen() {
if bank.slot() > *last_notified_confirmed_slot {
Expand All @@ -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());
Expand All @@ -209,6 +213,7 @@ impl OptimisticallyConfirmedBankTracker {
last_notified_confirmed_slot: &mut Slot,
pending_optimistically_confirmed_banks: &mut HashSet<Slot>,
slot_notification_subscribers: &Option<Arc<RwLock<Vec<SlotNotificationSender>>>>,
prioritization_fee_cache: &PrioritizationFeeCache,
) {
for confirmed_bank in bank.parents_inclusive().iter().rev() {
if confirmed_bank.slot() > slot_threshold {
Expand All @@ -223,6 +228,7 @@ impl OptimisticallyConfirmedBankTracker {
last_notified_confirmed_slot,
pending_optimistically_confirmed_banks,
slot_notification_subscribers,
prioritization_fee_cache,
);
}
}
Expand Down Expand Up @@ -291,6 +297,7 @@ impl OptimisticallyConfirmedBankTracker {
last_notified_confirmed_slot,
pending_optimistically_confirmed_banks,
slot_notification_subscribers,
prioritization_fee_cache,
);

*highest_confirmed_slot = slot;
Expand All @@ -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();
Expand Down Expand Up @@ -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 =
Expand Down

0 comments on commit 904b2a7

Please sign in to comment.