From cbcd3ef27e61f323f9d532e6dbb543246fcaf1bc Mon Sep 17 00:00:00 2001 From: Tao Zhu <82401714+taozhu-chicago@users.noreply.github.com> Date: Fri, 24 Feb 2023 23:50:02 -0600 Subject: [PATCH] Not allow transactions request zero CU to update prioritization fee cache (#30507) * filter out transaction requests zero cu from updating prioritization fee cache * updated comment --- runtime/src/prioritization_fee_cache.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/runtime/src/prioritization_fee_cache.rs b/runtime/src/prioritization_fee_cache.rs index aa0017ec2c..7df9c18078 100644 --- a/runtime/src/prioritization_fee_cache.rs +++ b/runtime/src/prioritization_fee_cache.rs @@ -219,6 +219,13 @@ impl PrioritizationFeeCache { if priority_details.is_none() || account_locks.is_err() { continue; } + let priority_details = priority_details.unwrap(); + + // filter out any transaction that requests zero compute_unit_limit + // since its priority fee amount is not instructive + if priority_details.compute_unit_limit == 0 { + continue; + } let writable_accounts = Arc::new( account_locks @@ -232,7 +239,7 @@ impl PrioritizationFeeCache { self.sender .send(CacheServiceUpdate::TransactionUpdate { slot: bank.slot(), - transaction_fee: priority_details.unwrap().priority, + transaction_fee: priority_details.priority, writable_accounts, }) .unwrap_or_else(|err| {