only executed transactions are used to update prioritization_fee_cache (#30868)
* only executed transactions are used to update prioritization_fee_cache * Update ledger/src/blockstore_processor.rs Co-authored-by: Andrew Fitzgerald <apfitzge@gmail.com>
This commit is contained in:
parent
8db35eb7e5
commit
653083806f
|
@ -132,6 +132,7 @@ fn execute_batch(
|
||||||
replay_vote_sender: Option<&ReplayVoteSender>,
|
replay_vote_sender: Option<&ReplayVoteSender>,
|
||||||
timings: &mut ExecuteTimings,
|
timings: &mut ExecuteTimings,
|
||||||
log_messages_bytes_limit: Option<usize>,
|
log_messages_bytes_limit: Option<usize>,
|
||||||
|
prioritization_fee_cache: &PrioritizationFeeCache,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let TransactionBatchWithIndexes {
|
let TransactionBatchWithIndexes {
|
||||||
batch,
|
batch,
|
||||||
|
@ -171,6 +172,12 @@ fn execute_batch(
|
||||||
..
|
..
|
||||||
} = tx_results;
|
} = tx_results;
|
||||||
|
|
||||||
|
let executed_transactions = execution_results
|
||||||
|
.iter()
|
||||||
|
.zip(batch.sanitized_transactions())
|
||||||
|
.filter_map(|(execution_result, tx)| execution_result.was_executed().then_some(tx))
|
||||||
|
.collect_vec();
|
||||||
|
|
||||||
if let Some(transaction_status_sender) = transaction_status_sender {
|
if let Some(transaction_status_sender) = transaction_status_sender {
|
||||||
let transactions = batch.sanitized_transactions().to_vec();
|
let transactions = batch.sanitized_transactions().to_vec();
|
||||||
let post_token_balances = if record_token_balances {
|
let post_token_balances = if record_token_balances {
|
||||||
|
@ -193,6 +200,8 @@ fn execute_batch(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prioritization_fee_cache.update(bank.clone(), executed_transactions.into_iter());
|
||||||
|
|
||||||
let first_err = get_first_error(batch, fee_collection_results);
|
let first_err = get_first_error(batch, fee_collection_results);
|
||||||
first_err.map(|(result, _)| result).unwrap_or(Ok(()))
|
first_err.map(|(result, _)| result).unwrap_or(Ok(()))
|
||||||
}
|
}
|
||||||
|
@ -210,6 +219,7 @@ fn execute_batches_internal(
|
||||||
transaction_status_sender: Option<&TransactionStatusSender>,
|
transaction_status_sender: Option<&TransactionStatusSender>,
|
||||||
replay_vote_sender: Option<&ReplayVoteSender>,
|
replay_vote_sender: Option<&ReplayVoteSender>,
|
||||||
log_messages_bytes_limit: Option<usize>,
|
log_messages_bytes_limit: Option<usize>,
|
||||||
|
prioritization_fee_cache: &PrioritizationFeeCache,
|
||||||
) -> Result<ExecuteBatchesInternalMetrics> {
|
) -> Result<ExecuteBatchesInternalMetrics> {
|
||||||
assert!(!batches.is_empty());
|
assert!(!batches.is_empty());
|
||||||
inc_new_counter_debug!("bank-par_execute_entries-count", batches.len());
|
inc_new_counter_debug!("bank-par_execute_entries-count", batches.len());
|
||||||
|
@ -233,6 +243,7 @@ fn execute_batches_internal(
|
||||||
replay_vote_sender,
|
replay_vote_sender,
|
||||||
&mut timings,
|
&mut timings,
|
||||||
log_messages_bytes_limit,
|
log_messages_bytes_limit,
|
||||||
|
prioritization_fee_cache,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
"execute_batch",
|
"execute_batch",
|
||||||
|
@ -302,6 +313,7 @@ fn execute_batches(
|
||||||
replay_vote_sender: Option<&ReplayVoteSender>,
|
replay_vote_sender: Option<&ReplayVoteSender>,
|
||||||
confirmation_timing: &mut ConfirmationTiming,
|
confirmation_timing: &mut ConfirmationTiming,
|
||||||
log_messages_bytes_limit: Option<usize>,
|
log_messages_bytes_limit: Option<usize>,
|
||||||
|
prioritization_fee_cache: &PrioritizationFeeCache,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
if batches.is_empty() {
|
if batches.is_empty() {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
|
@ -383,6 +395,7 @@ fn execute_batches(
|
||||||
transaction_status_sender,
|
transaction_status_sender,
|
||||||
replay_vote_sender,
|
replay_vote_sender,
|
||||||
log_messages_bytes_limit,
|
log_messages_bytes_limit,
|
||||||
|
prioritization_fee_cache,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
confirmation_timing.process_execute_batches_internal_metrics(execute_batches_internal_metrics);
|
confirmation_timing.process_execute_batches_internal_metrics(execute_batches_internal_metrics);
|
||||||
|
@ -479,6 +492,7 @@ fn process_entries(
|
||||||
replay_vote_sender,
|
replay_vote_sender,
|
||||||
confirmation_timing,
|
confirmation_timing,
|
||||||
log_messages_bytes_limit,
|
log_messages_bytes_limit,
|
||||||
|
prioritization_fee_cache,
|
||||||
)?;
|
)?;
|
||||||
batches.clear();
|
batches.clear();
|
||||||
for hash in &tick_hashes {
|
for hash in &tick_hashes {
|
||||||
|
@ -512,9 +526,6 @@ fn process_entries(
|
||||||
batch,
|
batch,
|
||||||
transaction_indexes,
|
transaction_indexes,
|
||||||
});
|
});
|
||||||
// entry is scheduled to be processed, transactions in it can be used to
|
|
||||||
// update prioritization fee cache asynchronously.
|
|
||||||
prioritization_fee_cache.update(bank.clone(), transactions.iter());
|
|
||||||
// done with this entry
|
// done with this entry
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -544,6 +555,7 @@ fn process_entries(
|
||||||
replay_vote_sender,
|
replay_vote_sender,
|
||||||
confirmation_timing,
|
confirmation_timing,
|
||||||
log_messages_bytes_limit,
|
log_messages_bytes_limit,
|
||||||
|
prioritization_fee_cache,
|
||||||
)?;
|
)?;
|
||||||
batches.clear();
|
batches.clear();
|
||||||
}
|
}
|
||||||
|
@ -558,6 +570,7 @@ fn process_entries(
|
||||||
replay_vote_sender,
|
replay_vote_sender,
|
||||||
confirmation_timing,
|
confirmation_timing,
|
||||||
log_messages_bytes_limit,
|
log_messages_bytes_limit,
|
||||||
|
prioritization_fee_cache,
|
||||||
)?;
|
)?;
|
||||||
for hash in tick_hashes {
|
for hash in tick_hashes {
|
||||||
bank.register_tick(hash);
|
bank.register_tick(hash);
|
||||||
|
|
Loading…
Reference in New Issue