Skip to content

Commit

Permalink
Synchronize message checking methods in SimpleProtocol with what's ac…
Browse files Browse the repository at this point in the history
…tually being sent
  • Loading branch information
fjarri committed Jan 10, 2025
1 parent aecfe06 commit f6c5357
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions examples/src/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,21 +94,21 @@ impl<Id> Protocol<Id> for SimpleProtocol {
message: &EchoBroadcast,
) -> Result<(), MessageValidationError> {
match round_id {
r if r == &1 => message.verify_is_some(),
r if r == &2 => message.verify_is_not::<Round2Message>(deserializer),
r if r == &1 => message.verify_is_not::<Round1Echo>(deserializer),
r if r == &2 => message.verify_is_some(),
_ => Err(MessageValidationError::InvalidEvidence("Invalid round number".into())),
}
}

fn verify_normal_broadcast_is_invalid(
_deserializer: &Deserializer,
deserializer: &Deserializer,
round_id: &RoundId,
message: &NormalBroadcast,
) -> Result<(), MessageValidationError> {
if round_id == &1 || round_id == &2 {
message.verify_is_some()
} else {
Err(MessageValidationError::InvalidEvidence("Invalid round number".into()))
match round_id {
r if r == &1 => message.verify_is_not::<Round1Broadcast>(deserializer),
r if r == &2 => message.verify_is_some(),
_ => Err(MessageValidationError::InvalidEvidence("Invalid round number".into())),
}
}
}
Expand Down

0 comments on commit f6c5357

Please sign in to comment.