Skip to content

Commit

Permalink
set age to 0 on epoch cross
Browse files Browse the repository at this point in the history
  • Loading branch information
apfitzge committed Apr 28, 2023
1 parent e22981b commit 3bb55b4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
3 changes: 2 additions & 1 deletion core/src/banking_stage/consumer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ impl Consumer {
&self,
bank: &Arc<Bank>,
txs: &[SanitizedTransaction],
max_slot_ages: &[Slot],
max_slot_ages: &mut [Slot],
) -> ProcessTransactionBatchOutput {
let (
(transaction_costs, transactions_qos_results, cost_model_throttled_transactions_count),
Expand All @@ -478,6 +478,7 @@ impl Consumer {
.map(|(tx, max_slot_age, qos_result)| match qos_result {
Ok(_) => {
if *max_slot_age < bank.slot() {
*max_slot_age = 0; // Sentinal value to indicate transaction was sanitized before epoch boundary
Err(TransactionError::BlockhashNotFound)
} else {
// TODO: Need to check that look-up tables have not been closed
Expand Down
11 changes: 7 additions & 4 deletions core/src/banking_stage/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,13 @@ impl Worker {
}

/// Consume a single batch.
fn consume(&self, bank: &Arc<Bank>, consume_work: ConsumeWork) -> Result<(), WorkerError> {
let summary =
self.consumer
.process_and_record_transactions(bank, &consume_work.transactions, 0);
fn consume(&self, bank: &Arc<Bank>, mut consume_work: ConsumeWork) -> Result<(), WorkerError> {
let summary = self.consumer.process_and_record_aged_transactions(
bank,
&consume_work.transactions,
&mut consume_work.max_age_slots,
);

self.consumed_sender.send(FinishedConsumeWork {
work: consume_work,
retryable_indexes: summary
Expand Down

0 comments on commit 3bb55b4

Please sign in to comment.