Refactoring internal bank method signature for consistency (#34936)

This commit is contained in:
Dmitri Makarov 2024-01-24 20:28:25 -05:00 committed by GitHub
parent 62e7ebd0cc
commit 5b59930782
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 6 deletions

View File

@ -4431,9 +4431,9 @@ impl Bank {
self.rc.accounts.accounts_db.set_shrink_paths(paths); self.rc.accounts.accounts_db.set_shrink_paths(paths);
} }
fn check_age<'a>( fn check_age(
&self, &self,
txs: impl Iterator<Item = &'a (impl core::borrow::Borrow<SanitizedTransaction> + 'a)>, sanitized_txs: &[impl core::borrow::Borrow<SanitizedTransaction>],
lock_results: &[Result<()>], lock_results: &[Result<()>],
max_age: usize, max_age: usize,
error_counters: &mut TransactionErrorMetrics, error_counters: &mut TransactionErrorMetrics,
@ -4442,7 +4442,9 @@ impl Bank {
let last_blockhash = hash_queue.last_hash(); let last_blockhash = hash_queue.last_hash();
let next_durable_nonce = DurableNonce::from_blockhash(&last_blockhash); let next_durable_nonce = DurableNonce::from_blockhash(&last_blockhash);
txs.zip(lock_results) sanitized_txs
.iter()
.zip(lock_results)
.map(|(tx, lock_res)| match lock_res { .map(|(tx, lock_res)| match lock_res {
Ok(()) => self.check_transaction_age( Ok(()) => self.check_transaction_age(
tx.borrow(), tx.borrow(),
@ -4560,9 +4562,8 @@ impl Bank {
max_age: usize, max_age: usize,
error_counters: &mut TransactionErrorMetrics, error_counters: &mut TransactionErrorMetrics,
) -> Vec<TransactionCheckResult> { ) -> Vec<TransactionCheckResult> {
let age_results = let lock_results = self.check_age(sanitized_txs, lock_results, max_age, error_counters);
self.check_age(sanitized_txs.iter(), lock_results, max_age, error_counters); self.check_status_cache(sanitized_txs, lock_results, error_counters)
self.check_status_cache(sanitized_txs, age_results, error_counters)
} }
pub fn collect_balances(&self, batch: &TransactionBatch) -> TransactionBalances { pub fn collect_balances(&self, batch: &TransactionBatch) -> TransactionBalances {