Skip to content

Commit

Permalink
always unlock in schedule_batches_for_execution
Browse files Browse the repository at this point in the history
  • Loading branch information
apfitzge committed Oct 3, 2024
1 parent fc21eb9 commit d02a08b
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions ledger/src/blockstore_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,10 @@ fn schedule_batches_for_execution(
bank: &BankWithScheduler,
locked_entries: impl Iterator<Item = LockedTransactionsWithIndexes<SanitizedTransaction>>,
) -> Result<()> {
// Track the first error encountered in the loop below, if any.
// This error will be propagated to the replay stage, or Ok(()).
let mut first_err = Ok(());

for LockedTransactionsWithIndexes {
lock_results,
transactions,
Expand All @@ -433,15 +437,19 @@ fn schedule_batches_for_execution(
{
// unlock before sending to scheduler.
bank.unlock_accounts(transactions.iter().zip(lock_results.iter()));
// give ownership to scheduler
bank.schedule_transaction_executions(
transactions
.into_iter()
.enumerate()
.map(|(index, tx)| (tx, index + starting_index)),
)?;
// give ownership to scheduler. capture the first error, but continue the loop
// to unlock.
// scheduling is skipped if we have already detected an error in this loop
first_err = first_err.and_then(|()| {
bank.schedule_transaction_executions(
transactions
.into_iter()
.enumerate()
.map(|(index, tx)| (tx, index + starting_index)),
)
});
}
Ok(())
first_err
}

fn rebatch_transactions<'a>(
Expand Down

0 comments on commit d02a08b

Please sign in to comment.