SVM: minor refactoring to improve code readability (#317)

This commit is contained in:
Dmitri Makarov 2024-03-19 15:32:07 -04:00 committed by GitHub
parent e8526f60aa
commit f1d56e95f5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 5 deletions

View File

@ -342,11 +342,11 @@ impl<FG: ForkGraph> TransactionBatchProcessor<FG> {
fn filter_executable_program_accounts<'a, CB: TransactionProcessingCallback>( fn filter_executable_program_accounts<'a, CB: TransactionProcessingCallback>(
callbacks: &CB, callbacks: &CB,
txs: &[SanitizedTransaction], txs: &[SanitizedTransaction],
lock_results: &mut [TransactionCheckResult], check_results: &mut [TransactionCheckResult],
program_owners: &'a [Pubkey], program_owners: &'a [Pubkey],
) -> HashMap<Pubkey, (&'a Pubkey, u64)> { ) -> HashMap<Pubkey, (&'a Pubkey, u64)> {
let mut result: HashMap<Pubkey, (&'a Pubkey, u64)> = HashMap::new(); let mut result: HashMap<Pubkey, (&'a Pubkey, u64)> = HashMap::new();
lock_results.iter_mut().zip(txs).for_each(|etx| { check_results.iter_mut().zip(txs).for_each(|etx| {
if let ((Ok(()), _nonce, lamports_per_signature), tx) = etx { if let ((Ok(()), _nonce, lamports_per_signature), tx) = etx {
if lamports_per_signature.is_some() { if lamports_per_signature.is_some() {
tx.message() tx.message()
@ -361,9 +361,9 @@ impl<FG: ForkGraph> TransactionBatchProcessor<FG> {
if let Some(index) = if let Some(index) =
callbacks.account_matches_owners(key, program_owners) callbacks.account_matches_owners(key, program_owners)
{ {
program_owners if let Some(owner) = program_owners.get(index) {
.get(index) entry.insert((owner, 1));
.map(|owner| entry.insert((owner, 1))); }
} }
} }
}); });