Skip to content

Commit

Permalink
Clean up pre_commit_callback wrapping code
Browse files Browse the repository at this point in the history
  • Loading branch information
ryoqun committed Dec 19, 2024
1 parent 73686a2 commit 75faba8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
14 changes: 6 additions & 8 deletions ledger/src/blockstore_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,14 +180,12 @@ pub fn execute_batch(
let is_block_producing_unified_scheduler = pre_commit_callback.is_some();
let pre_commit_callback = pre_commit_callback.map(|wrapped_callback| {
|| {
wrapped_callback()
.inspect(|&maybe_index| {
if let Some(index) = maybe_index {
assert!(transaction_indexes.is_empty());
transaction_indexes.to_mut().push(index);
}
})
.map(|_| ())
wrapped_callback().map(|maybe_index| {
assert!(transaction_indexes.is_empty());
transaction_indexes.to_mut().extend(maybe_index);
// Strip the index away by implicitly returning (), now that we're done with it
// here (= `solana-ledger`), to make `solana-runtime` not bothered with it.
})
}
});

Expand Down
2 changes: 1 addition & 1 deletion unified-scheduler-pool/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ impl TaskHandler for DefaultTaskHandler {
if handler_context.transaction_status_sender.is_some() {
// Adjust the empty new vec with the exact needed capacity, which will be
// filled inside `execute_batch()` below. Otherwise, excess cap would be
// reserved on `.push(transaction_index)` in it.
// reserved on `.extend()` in it.
vec.reserve_exact(1);
}
vec
Expand Down

0 comments on commit 75faba8

Please sign in to comment.