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

Commit

Permalink
Add more comments for process_batches()
Browse files Browse the repository at this point in the history
  • Loading branch information
ryoqun committed Oct 27, 2023
1 parent 9491e33 commit 2897280
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions ledger/src/blockstore_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,11 @@ fn execute_batches_internal(
})
}

// This fn diverts the code-path into two variants. Both must provide exactly the same set of
// validations. For this reason, this fn is deliberately inserted into the code path to be called
// inside process_entries(), so that Bank::prepare_sanitized_batch() has been called on all of
// batches already. That's because the scheduler variant can't implement the batch sanitization
// naively, due to the nature of individual tx processing.
fn process_batches(
bank: &BankWithScheduler,
batches: &[TransactionBatchWithIndexes],
Expand All @@ -308,7 +313,11 @@ fn process_batches(
"process_batches()/schedule_batches_for_execution({} batches)",
batches.len()
);
schedule_batches_for_execution(bank, batches)
// scheduling always succeeds here without being blocked on actual transaction executions.
// The transaction execution errors will be collected via the blocking fn called
// BankWithScheduler::wait_for_completed_scheduler(), if any.
schedule_batches_for_execution(bank, batches);
Ok(())
} else {
debug!(
"process_batches()/rebatch_and_execute_batches({} batches)",
Expand All @@ -329,7 +338,7 @@ fn process_batches(
fn schedule_batches_for_execution(
bank: &BankWithScheduler,
batches: &[TransactionBatchWithIndexes],
) -> Result<()> {
) {
for TransactionBatchWithIndexes {
batch,
transaction_indexes,
Expand All @@ -340,7 +349,6 @@ fn schedule_batches_for_execution(
transaction_indexes.iter(),
);
}
Ok(())
}

fn rebatch_transactions<'a>(
Expand Down

0 comments on commit 2897280

Please sign in to comment.