From 8b22b92fc1b2d9402a13e3d5b3932c53d93696c1 Mon Sep 17 00:00:00 2001 From: Andrew Fitzgerald Date: Tue, 13 Aug 2024 13:32:53 -0500 Subject: [PATCH] prioritization_fee_cache: remove get_account_locks (#2556) --- runtime/src/prioritization_fee_cache.rs | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/runtime/src/prioritization_fee_cache.rs b/runtime/src/prioritization_fee_cache.rs index 332449e81c04c1..bafbde9f7411aa 100644 --- a/runtime/src/prioritization_fee_cache.rs +++ b/runtime/src/prioritization_fee_cache.rs @@ -2,6 +2,7 @@ use { crate::{bank::Bank, prioritization_fee::*}, crossbeam_channel::{unbounded, Receiver, Sender}, log::*, + solana_accounts_db::account_locks::validate_account_locks, solana_measure::measure_us, solana_runtime_transaction::instructions_processor::process_compute_budget_instructions, solana_sdk::{ @@ -205,10 +206,14 @@ impl PrioritizationFeeCache { let compute_budget_limits = process_compute_budget_instructions( sanitized_transaction.message().program_instructions_iter(), ); - let account_locks = sanitized_transaction - .get_account_locks(bank.get_transaction_account_lock_limit()); - if compute_budget_limits.is_err() || account_locks.is_err() { + let message = sanitized_transaction.message(); + let lock_result = validate_account_locks( + message.account_keys(), + bank.get_transaction_account_lock_limit(), + ); + + if compute_budget_limits.is_err() || lock_result.is_err() { continue; } let compute_budget_limits = compute_budget_limits.unwrap(); @@ -219,12 +224,13 @@ impl PrioritizationFeeCache { continue; } - let writable_accounts = account_locks - .unwrap() - .writable + let writable_accounts = message + .account_keys() .iter() - .map(|key| **key) - .collect::>(); + .enumerate() + .filter(|(index, _)| message.is_writable(*index)) + .map(|(_, key)| *key) + .collect(); self.sender .send(CacheServiceUpdate::TransactionUpdate {