Refactor accounts.rs with Justin's comments to improve lock accounts (#21406)
with results code path. - fix a bug that could unlock accounts that weren't locked - add test to the refactored function - skip enumerating transaction accounts if qos results is an error - add #[must_use] annotation - avoid clone error in results - add qos error code to unlock_accounts match statement - remove unnecessary AbiExample
This commit is contained in:
@ -940,7 +940,8 @@ impl BankingStage {
|
||||
// Once accounts are locked, other threads cannot encode transactions that will modify the
|
||||
// same account state
|
||||
let mut lock_time = Measure::start("lock_time");
|
||||
let batch = bank.prepare_sanitized_batch_with_results(txs, transactions_qos_results.iter());
|
||||
let batch =
|
||||
bank.prepare_sanitized_batch_with_results(txs, transactions_qos_results.into_iter());
|
||||
lock_time.stop();
|
||||
|
||||
// retryable_txs includes AccountInUse, WouldExceedMaxBlockCostLimit and
|
||||
|
@ -24,6 +24,10 @@ use {
|
||||
};
|
||||
|
||||
pub struct QosService {
|
||||
// cost_model instance is owned by validator, shared between replay_stage and
|
||||
// banking_stage. replay_stage writes the latest on-chain program timings to
|
||||
// it; banking_stage's qos_service reads that information to calculate
|
||||
// transaction cost, hence RwLock wrapped.
|
||||
cost_model: Arc<RwLock<CostModel>>,
|
||||
metrics: Arc<QosServiceMetrics>,
|
||||
reporting_thread: Option<JoinHandle<()>>,
|
||||
|
Reference in New Issue
Block a user