diff --git a/core/src/replay_stage.rs b/core/src/replay_stage.rs index 82ad741bd48adf..543ff8338d45b6 100644 --- a/core/src/replay_stage.rs +++ b/core/src/replay_stage.rs @@ -2719,7 +2719,6 @@ impl ReplayStage { ancestor_hashes_replay_update_sender: &AncestorHashesReplayUpdateSender, block_metadata_notifier: Option, replay_result_vec: &[ReplaySlotFromBlockstore], - prioritization_fee_cache: &PrioritizationFeeCache, purge_repair_slot_counter: &mut PurgeRepairSlotCounter, ) -> bool { // TODO: See if processing of blockstore replay results and bank completion can be made thread safe. @@ -2795,9 +2794,6 @@ impl ReplayStage { warn!("cost_update_sender failed sending bank stats: {:?}", err) }); - // finalize block's minimum prioritization fee cache for this bank - prioritization_fee_cache.finalize_priority_fee(bank.slot()); - assert_ne!(bank.hash(), Hash::default()); // Needs to be updated before `check_slot_agrees_with_cluster()` so that // any updates in `check_slot_agrees_with_cluster()` on fork choice take @@ -2985,7 +2981,6 @@ impl ReplayStage { ancestor_hashes_replay_update_sender, block_metadata_notifier, &replay_result_vec, - prioritization_fee_cache, purge_repair_slot_counter, ) } else { diff --git a/core/src/validator.rs b/core/src/validator.rs index 70e06d6607ea33..0e6f2f82f7991f 100644 --- a/core/src/validator.rs +++ b/core/src/validator.rs @@ -989,6 +989,7 @@ impl Validator { optimistically_confirmed_bank, rpc_subscriptions.clone(), confirmed_bank_subscribers, + prioritization_fee_cache.clone(), )), Some(BankNotificationSenderConfig { sender: bank_notification_sender, diff --git a/rpc/src/optimistically_confirmed_bank_tracker.rs b/rpc/src/optimistically_confirmed_bank_tracker.rs index dacfcd9b32ebb9..db88460110690a 100644 --- a/rpc/src/optimistically_confirmed_bank_tracker.rs +++ b/rpc/src/optimistically_confirmed_bank_tracker.rs @@ -12,7 +12,9 @@ use { crate::rpc_subscriptions::RpcSubscriptions, crossbeam_channel::{Receiver, RecvTimeoutError, Sender}, solana_rpc_client_api::response::{SlotTransactionStats, SlotUpdate}, - solana_runtime::{bank::Bank, bank_forks::BankForks}, + solana_runtime::{ + bank::Bank, bank_forks::BankForks, prioritization_fee_cache::PrioritizationFeeCache, + }, solana_sdk::{clock::Slot, timing::timestamp}, std::{ collections::HashSet, @@ -92,6 +94,7 @@ impl OptimisticallyConfirmedBankTracker { optimistically_confirmed_bank: Arc>, subscriptions: Arc, slot_notification_subscribers: Option>>>, + prioritization_fee_cache: Arc, ) -> Self { let mut pending_optimistically_confirmed_banks = HashSet::new(); let mut last_notified_confirmed_slot: Slot = 0; @@ -114,6 +117,7 @@ impl OptimisticallyConfirmedBankTracker { &mut highest_confirmed_slot, &mut newest_root_slot, &slot_notification_subscribers, + &prioritization_fee_cache, ) { break; } @@ -122,6 +126,7 @@ impl OptimisticallyConfirmedBankTracker { Self { thread_hdl } } + #[allow(clippy::too_many_arguments)] fn recv_notification( receiver: &Receiver, bank_forks: &Arc>, @@ -132,6 +137,7 @@ impl OptimisticallyConfirmedBankTracker { highest_confirmed_slot: &mut Slot, newest_root_slot: &mut Slot, slot_notification_subscribers: &Option>>>, + prioritization_fee_cache: &Arc, ) -> Result<(), RecvTimeoutError> { let notification = receiver.recv_timeout(Duration::from_secs(1))?; Self::process_notification( @@ -144,6 +150,7 @@ impl OptimisticallyConfirmedBankTracker { highest_confirmed_slot, newest_root_slot, slot_notification_subscribers, + prioritization_fee_cache, ); Ok(()) } @@ -249,6 +256,7 @@ impl OptimisticallyConfirmedBankTracker { } } + #[allow(clippy::too_many_arguments)] pub fn process_notification( notification: BankNotification, bank_forks: &Arc>, @@ -259,6 +267,7 @@ impl OptimisticallyConfirmedBankTracker { highest_confirmed_slot: &mut Slot, newest_root_slot: &mut Slot, slot_notification_subscribers: &Option>>>, + prioritization_fee_cache: &Arc, ) { debug!("received bank notification: {:?}", notification); match notification { @@ -298,6 +307,9 @@ 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();