Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prioritization_fee_cache: remove get_account_locks #2556

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion accounts-db/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
extern crate lazy_static;

pub mod account_info;
mod account_locks;
pub mod account_locks;
pub mod account_storage;
pub mod accounts;
mod accounts_cache;
Expand Down
22 changes: 14 additions & 8 deletions runtime/src/prioritization_fee_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down Expand Up @@ -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();
Expand All @@ -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::<Vec<_>>();
.enumerate()
.filter(|(index, _)| message.is_writable(*index))
.map(|(_, key)| *key)
.collect();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

additional saving from filtering out read-only accounts 👍🏼


self.sender
.send(CacheServiceUpdate::TransactionUpdate {
Expand Down