Skip to content

Commit

Permalink
consensus: remove iteration from collect_from_past
Browse files Browse the repository at this point in the history
  • Loading branch information
herr-seppia committed Jan 15, 2024
1 parent b06789d commit 87c190a
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 14 deletions.
15 changes: 5 additions & 10 deletions consensus/src/iteration_ctx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,28 +149,23 @@ impl<D: Database> IterationCtx<D> {
msg: Message,
) -> Option<Message> {
let committee = self.committees.get_committee(msg.header.get_step())?;
let iteration = msg.header.iteration;
match msg.topic() {
node_data::message::Topics::Candidate => {
let mut handler = self.proposal_handler.lock().await;
_ = handler
.collect_from_past(msg, ru, iteration, committee)
.await;
_ = handler.collect_from_past(msg, ru, committee).await;
}
node_data::message::Topics::Validation => {
let mut handler = self.validation_handler.lock().await;
if let Ok(Ready(m)) = handler
.collect_from_past(msg, ru, iteration, committee)
.await
if let Ok(Ready(m)) =
handler.collect_from_past(msg, ru, committee).await
{
return Some(m);
}
}
node_data::message::Topics::Ratification => {
let mut handler = self.ratification_handler.lock().await;
if let Ok(Ready(m)) = handler
.collect_from_past(msg, ru, iteration, committee)
.await
if let Ok(Ready(m)) =
handler.collect_from_past(msg, ru, committee).await
{
return Some(m);
}
Expand Down
1 change: 0 additions & 1 deletion consensus/src/msg_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ pub trait MsgHandler<T: Debug + MessageTrait> {
&mut self,
msg: T,
ru: &RoundUpdate,
iteration: u8,
committee: &Committee,
) -> Result<HandleMsgOutput, ConsensusError>;

Expand Down
1 change: 0 additions & 1 deletion consensus/src/proposal/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ impl<D: Database> MsgHandler<Message> for ProposalHandler<D> {
&mut self,
msg: Message,
_ru: &RoundUpdate,
_iteration: u8,
_committee: &Committee,
) -> Result<HandleMsgOutput, ConsensusError> {
Ok(HandleMsgOutput::Pending(msg))
Expand Down
2 changes: 1 addition & 1 deletion consensus/src/ratification/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ impl MsgHandler<Message> for RatificationHandler {
&mut self,
msg: Message,
_ru: &RoundUpdate,
iteration: u8,
committee: &Committee,
) -> Result<HandleMsgOutput, ConsensusError> {
let ratification = Self::unwrap_msg(&msg)?;
let iteration = msg.header.iteration;

// Collect vote, if msg payload is reduction type
if let Some((hash, sv, quorum_reached)) = self.aggregator.collect_vote(
Expand Down
2 changes: 1 addition & 1 deletion consensus/src/validation/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@ impl MsgHandler<Message> for ValidationHandler {
&mut self,
msg: Message,
_ru: &RoundUpdate,
iteration: u8,
committee: &Committee,
) -> Result<HandleMsgOutput, ConsensusError> {
let iteration = msg.header.iteration;
let signature = match &msg.payload {
Payload::Validation(p) => Ok(p.signature),
_ => Err(ConsensusError::InvalidMsgType),
Expand Down

0 comments on commit 87c190a

Please sign in to comment.