Skip to content

Commit

Permalink
fix index out of bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
bchocho committed Nov 4, 2024
1 parent b40e5ce commit 9f90b71
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion consensus/src/execution_pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ impl ExecutionPipeline {
}
});

let num_txns_to_execute = blocking_txns_provider.num_txns();
let blocking_txns_writer = blocking_txns_provider.clone();
let join_shuffle = tokio::task::spawn_blocking(move || {
// TODO: keep this previously split so we don't have to re-split it here
Expand All @@ -352,13 +353,15 @@ impl ExecutionPipeline {
for (idx, txn) in validator_txns
.into_iter()
.chain(shuffle_iterator)
.take(num_txns_to_execute)
.enumerate()
{
blocking_txns_writer.set_txn(idx as TxnIndex, txn);
}
} else {
// TODO: could num_txns_to_execute < number of validator txns?
// No user transactions in the block.
for (idx, txn) in txns.into_iter().enumerate() {
for (idx, txn) in txns.into_iter().take(num_txns_to_execute).enumerate() {
blocking_txns_writer.set_txn(idx as TxnIndex, txn);
}
}
Expand Down

0 comments on commit 9f90b71

Please sign in to comment.