Skip to content

Commit

Permalink
Avoid cloning the proposal
Browse files Browse the repository at this point in the history
  • Loading branch information
romac committed Nov 3, 2023
1 parent 5cdc87c commit 828f7af
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Code/consensus/src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ where

fn apply_proposal(&mut self, proposal: Ctx::Proposal) -> Option<RoundMessage<Ctx>> {
// TODO: Check for invalid proposal
let event = RoundEvent::Proposal(proposal.clone());

// Check that there is an ongoing round
let Some(round_state) = self.round_states.get(&self.round) else {
Expand Down Expand Up @@ -176,7 +175,9 @@ where
Round::Nil => {
// Is it possible to get +2/3 prevotes before the proposal?
// Do we wait for our own prevote to check the threshold?
self.apply_event(proposal.round(), event)
let round = proposal.round();
let event = RoundEvent::Proposal(proposal);
self.apply_event(round, event)
}
Round::Some(_)
if self.votes.is_threshold_met(
Expand All @@ -185,7 +186,9 @@ where
Threshold::Value(proposal.value().id()),
) =>
{
self.apply_event(proposal.round(), event)
let round = proposal.round();
let event = RoundEvent::Proposal(proposal);
self.apply_event(round, event)
}
_ => None,
}
Expand Down

0 comments on commit 828f7af

Please sign in to comment.