From 586c57afa7af796185c76c8ff26bc37e813957c2 Mon Sep 17 00:00:00 2001 From: max-dfinity <100170574+max-dfinity@users.noreply.github.com> Date: Wed, 18 Dec 2024 11:05:39 -0800 Subject: [PATCH] refactor(nns): Clarify voting code (#3210) Small change to clarify voting function. --- rs/nns/governance/src/voting.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/rs/nns/governance/src/voting.rs b/rs/nns/governance/src/voting.rs index 3c3aa07786e..86a5389e29e 100644 --- a/rs/nns/governance/src/voting.rs +++ b/rs/nns/governance/src/voting.rs @@ -202,16 +202,16 @@ impl Governance { is_over_soft_limit: fn() -> bool, ) { let proposal_id = machine.proposal_id; + let Ok(ballots) = proposal_ballots(&mut self.heap_data.proposals, proposal_id.id) else { + eprintln!( + "{} Proposal {} for voting machine not found. Machine cannot complete work.", + LOG_PREFIX, proposal_id.id + ); + return; + }; + while !machine.is_completely_finished() { - if let Ok(ballots) = proposal_ballots(&mut self.heap_data.proposals, proposal_id.id) { - machine.continue_processing(&mut self.neuron_store, ballots, is_over_soft_limit); - } else { - eprintln!( - "{} Proposal {} for voting machine not found. Machine cannot complete work.", - LOG_PREFIX, proposal_id.id - ); - break; - } + machine.continue_processing(&mut self.neuron_store, ballots, is_over_soft_limit); if is_over_soft_limit() { break;