Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Commit

Permalink
Simplify schedule_transaction_executions type
Browse files Browse the repository at this point in the history
  • Loading branch information
ryoqun committed Oct 27, 2023
1 parent 6e63d87 commit 5d856f9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 4 additions & 2 deletions ledger/src/blockstore_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,10 @@ fn schedule_batches_for_execution(
} in batches
{
bank.schedule_transaction_executions(
batch.sanitized_transactions(),
transaction_indexes.iter(),
batch
.sanitized_transactions()
.iter()
.zip(transaction_indexes.iter()),
);
}
}
Expand Down
7 changes: 3 additions & 4 deletions runtime/src/installed_scheduler_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,17 @@ impl BankWithScheduler {
// 'a is needed; anonymous_lifetime_in_impl_trait isn't stabilized yet...
pub fn schedule_transaction_executions<'a>(
&self,
transactions: &[SanitizedTransaction],
transaction_indexes: impl Iterator<Item = &'a usize>,
transactions_with_indexes: impl ExactSizeIterator<Item = (&'a SanitizedTransaction, &'a usize)>,
) {
trace!(
"schedule_transaction_executions(): {} txs",
transactions.len()
transactions_with_indexes.len()
);

let scheduler_guard = self.inner.scheduler.read().unwrap();
let scheduler = scheduler_guard.as_ref().unwrap();

for (sanitized_transaction, &index) in transactions.iter().zip(transaction_indexes) {
for (sanitized_transaction, &index) in transactions_with_indexes {
scheduler.schedule_execution(&(sanitized_transaction, index));
}
}
Expand Down

0 comments on commit 5d856f9

Please sign in to comment.