From 508d838bc7672cbe7996277d70f32108da45a19e Mon Sep 17 00:00:00 2001 From: Andrew Fitzgerald Date: Thu, 29 Feb 2024 23:41:38 -0800 Subject: [PATCH] Comments clarifying non-emptiness of threadset --- .../transaction_scheduler/prio_graph_scheduler.rs | 3 ++- .../transaction_scheduler/thread_aware_account_locks.rs | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/banking_stage/transaction_scheduler/prio_graph_scheduler.rs b/core/src/banking_stage/transaction_scheduler/prio_graph_scheduler.rs index e0b53a97ab020e..d983fcf4d163c3 100644 --- a/core/src/banking_stage/transaction_scheduler/prio_graph_scheduler.rs +++ b/core/src/banking_stage/transaction_scheduler/prio_graph_scheduler.rs @@ -388,7 +388,8 @@ impl PrioGraphScheduler { /// If the `chain_thread` is available, this thread will be selected, regardless of /// load-balancing. /// - /// Panics if the `thread_set` is empty. + /// Panics if the `thread_set` is empty. This should never happen, see comment + /// on `ThreadAwareAccountLocks::try_lock_accounts`. fn select_thread( thread_set: ThreadSet, batches_per_thread: &[Vec], diff --git a/core/src/banking_stage/transaction_scheduler/thread_aware_account_locks.rs b/core/src/banking_stage/transaction_scheduler/thread_aware_account_locks.rs index d17cc25556f92f..4a9cfd2df9edcf 100644 --- a/core/src/banking_stage/transaction_scheduler/thread_aware_account_locks.rs +++ b/core/src/banking_stage/transaction_scheduler/thread_aware_account_locks.rs @@ -65,6 +65,8 @@ impl ThreadAwareAccountLocks { /// `allowed_threads` is a set of threads that the caller restricts locking to. /// If accounts are schedulable, then they are locked for the thread /// selected by the `thread_selector` function. + /// `thread_selector` is only called if all accounts are schdulable, meaning + /// that the `thread_set` passed to `thread_selector` is non-empty. pub(crate) fn try_lock_accounts<'a>( &mut self, write_account_locks: impl Iterator + Clone,