Refactor: check_transactions - allow borrowed transactions (#34232)

This commit is contained in:
Andrew Fitzgerald 2023-11-28 08:24:16 -08:00 committed by GitHub
parent 656ec4bdf0
commit 40f5870a47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 4 deletions

View File

@ -4519,7 +4519,7 @@ impl Bank {
fn check_age<'a>(
&self,
txs: impl Iterator<Item = &'a SanitizedTransaction>,
txs: impl Iterator<Item = &'a (impl core::borrow::Borrow<SanitizedTransaction> + 'a)>,
lock_results: &[Result<()>],
max_age: usize,
error_counters: &mut TransactionErrorMetrics,
@ -4531,7 +4531,7 @@ impl Bank {
txs.zip(lock_results)
.map(|(tx, lock_res)| match lock_res {
Ok(()) => self.check_transaction_age(
tx,
tx.borrow(),
max_age,
&next_durable_nonce,
&hash_queue,
@ -4577,7 +4577,7 @@ impl Bank {
fn check_status_cache(
&self,
sanitized_txs: &[SanitizedTransaction],
sanitized_txs: &[impl core::borrow::Borrow<SanitizedTransaction>],
lock_results: Vec<TransactionCheckResult>,
error_counters: &mut TransactionErrorMetrics,
) -> Vec<TransactionCheckResult> {
@ -4586,6 +4586,7 @@ impl Bank {
.iter()
.zip(lock_results)
.map(|(sanitized_tx, (lock_result, nonce))| {
let sanitized_tx = sanitized_tx.borrow();
if lock_result.is_ok()
&& self.is_transaction_already_processed(sanitized_tx, &rcache)
{
@ -4640,7 +4641,7 @@ impl Bank {
pub fn check_transactions(
&self,
sanitized_txs: &[SanitizedTransaction],
sanitized_txs: &[impl core::borrow::Borrow<SanitizedTransaction>],
lock_results: &[Result<()>],
max_age: usize,
error_counters: &mut TransactionErrorMetrics,