Only need bank reference for update (#30879)

This commit is contained in:
Andrew Fitzgerald 2023-03-24 09:48:04 -07:00 committed by GitHub
parent 6c58a84d85
commit f226a34f48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 7 deletions

View File

@ -131,7 +131,7 @@ impl Committer {
starting_transaction_index, starting_transaction_index,
); );
self.prioritization_fee_cache self.prioritization_fee_cache
.update(bank.clone(), executed_transactions.into_iter()); .update(bank, executed_transactions.into_iter());
}); });
execute_and_commit_timings.find_and_send_votes_us = find_and_send_votes_us; execute_and_commit_timings.find_and_send_votes_us = find_and_send_votes_us;
(commit_time_us, commit_transaction_statuses) (commit_time_us, commit_transaction_statuses)

View File

@ -200,7 +200,7 @@ fn execute_batch(
); );
} }
prioritization_fee_cache.update(bank.clone(), executed_transactions.into_iter()); prioritization_fee_cache.update(bank, executed_transactions.into_iter());
let first_err = get_first_error(batch, fee_collection_results); let first_err = get_first_error(batch, fee_collection_results);
first_err.map(|(result, _)| result).unwrap_or(Ok(())) first_err.map(|(result, _)| result).unwrap_or(Ok(()))

View File

@ -5015,7 +5015,7 @@ pub mod tests {
.into_iter() .into_iter()
.map(|tx| SanitizedTransaction::try_from_legacy_transaction(tx).unwrap()) .map(|tx| SanitizedTransaction::try_from_legacy_transaction(tx).unwrap())
.collect(); .collect();
prioritization_fee_cache.update(bank, transactions.iter()); prioritization_fee_cache.update(&bank, transactions.iter());
} }
fn get_prioritization_fee_cache(&self) -> &PrioritizationFeeCache { fn get_prioritization_fee_cache(&self) -> &PrioritizationFeeCache {

View File

@ -59,7 +59,7 @@ fn bench_process_transactions_single_slot(bencher: &mut Bencher) {
.collect(); .collect();
bencher.iter(|| { bencher.iter(|| {
prioritization_fee_cache.update(bank.clone(), transactions.iter()); prioritization_fee_cache.update(&bank, transactions.iter());
}); });
} }
@ -87,7 +87,7 @@ fn process_transactions_multiple_slots(banks: &[Arc<Bank>], num_slots: usize, nu
let index = thread_rng().gen_range(0, num_slots); let index = thread_rng().gen_range(0, num_slots);
prioritization_fee_cache.update(banks[index].clone(), transactions.iter()); prioritization_fee_cache.update(&banks[index], transactions.iter());
}) })
} }
} }

View File

@ -201,7 +201,7 @@ impl PrioritizationFeeCache {
/// Update with a list of non-vote transactions' tx_priority_details and tx_account_locks; Only /// Update with a list of non-vote transactions' tx_priority_details and tx_account_locks; Only
/// transactions have both valid priority_detail and account_locks will be used to update /// transactions have both valid priority_detail and account_locks will be used to update
/// fee_cache asynchronously. /// fee_cache asynchronously.
pub fn update<'a>(&self, bank: Arc<Bank>, txs: impl Iterator<Item = &'a SanitizedTransaction>) { pub fn update<'a>(&self, bank: &Bank, txs: impl Iterator<Item = &'a SanitizedTransaction>) {
let mut successful_transaction_update_count: u64 = 0; let mut successful_transaction_update_count: u64 = 0;
let (_, send_updates_time) = measure!( let (_, send_updates_time) = measure!(
{ {
@ -427,7 +427,7 @@ mod tests {
bank: Arc<Bank>, bank: Arc<Bank>,
txs: impl Iterator<Item = &'a SanitizedTransaction>, txs: impl Iterator<Item = &'a SanitizedTransaction>,
) { ) {
prioritization_fee_cache.update(bank.clone(), txs); prioritization_fee_cache.update(&bank, txs);
let block_fee = PrioritizationFeeCache::get_prioritization_fee( let block_fee = PrioritizationFeeCache::get_prioritization_fee(
prioritization_fee_cache.cache.clone(), prioritization_fee_cache.cache.clone(),