-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(driver): Move proposal validity into
Propose
message (#66)
- Loading branch information
Showing
7 changed files
with
46 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
use malachite_common::{Context, Round, SignedVote, Timeout}; | ||
|
||
use crate::Validity; | ||
|
||
/// Events that can be received by the [`Driver`](crate::Driver). | ||
#[derive(Clone, Debug, PartialEq, Eq)] | ||
pub enum Event<Ctx> | ||
where | ||
Ctx: Context, | ||
{ | ||
NewRound(Round), | ||
Proposal(Ctx::Proposal), | ||
Proposal(Ctx::Proposal, Validity), | ||
Vote(SignedVote<Ctx>), | ||
TimeoutElapsed(Timeout), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/// Wether or not a proposal is valid. | ||
#[derive(Copy, Clone, Debug, PartialEq, Eq)] | ||
pub enum Validity { | ||
/// The proposal is valid. | ||
Valid, | ||
/// The proposal is invalid. | ||
Invalid, | ||
} | ||
|
||
impl Validity { | ||
/// Returns `true` if the proposal is valid. | ||
pub fn is_valid(self) -> bool { | ||
self == Validity::Valid | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters