Don't request votes if there is nothing to request. (#5888)

* Don't request votes if there is nothing to request.

* Add trace log
This commit is contained in:
Robert Klotzner
2022-08-16 16:49:25 +02:00
committed by GitHub
parent ca6297c853
commit 05a7966505
@@ -713,6 +713,12 @@ async fn request_votes(
sender: &mut impl overseer::ProvisionerSenderTrait,
disputes_to_query: Vec<(SessionIndex, CandidateHash)>,
) -> Vec<(SessionIndex, CandidateHash, CandidateVotes)> {
// No need to send dummy request, if nothing to request:
if disputes_to_query.is_empty() {
gum::trace!(target: LOG_TARGET, "No disputes, nothing to request - returning empty `Vec`.");
return Vec::new()
}
let (tx, rx) = oneshot::channel();
// Bounded by block production - `ProvisionerMessage::RequestInherentData`.
sender.send_unbounded_message(DisputeCoordinatorMessage::QueryCandidateVotes(