Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.33 compat followup #296

Merged
merged 2 commits into from
Jun 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions tendermint/src/block/commit_sig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl TryFrom<RawCommitSig> for CommitSig {

fn try_from(value: RawCommitSig) -> Result<Self, Self::Error> {
match value.block_id_flag {
BlockIDFlag::BlockIDFlagAbsent => {
BlockIDFlag::Absent => {
if value.timestamp.is_some()
&& value.timestamp.unwrap()
!= Time::parse_from_rfc3339("0001-01-01T00:00:00Z").unwrap()
Expand All @@ -53,7 +53,7 @@ impl TryFrom<RawCommitSig> for CommitSig {
}
Ok(CommitSig::BlockIDFlagAbsent)
}
BlockIDFlag::BlockIDFlagCommit => {
BlockIDFlag::Commit => {
if value.timestamp.is_none() {
Err("timestamp is missing for BlockIDFlagCommit CommitSig")
} else if value.signature.is_none() {
Expand All @@ -68,7 +68,7 @@ impl TryFrom<RawCommitSig> for CommitSig {
})
}
}
BlockIDFlag::BlockIDFlagNil => {
BlockIDFlag::Nil => {
if value.timestamp.is_none() {
Err("timestamp is missing for BlockIDFlagNil CommitSig")
} else if value.signature.is_none() {
Expand All @@ -91,7 +91,7 @@ impl From<CommitSig> for RawCommitSig {
fn from(commit: CommitSig) -> RawCommitSig {
match commit {
CommitSig::BlockIDFlagAbsent => RawCommitSig {
block_id_flag: BlockIDFlag::BlockIDFlagAbsent,
block_id_flag: BlockIDFlag::Absent,
validator_address: None,
timestamp: None,
signature: None,
Expand All @@ -101,7 +101,7 @@ impl From<CommitSig> for RawCommitSig {
timestamp,
signature,
} => RawCommitSig {
block_id_flag: BlockIDFlag::BlockIDFlagNil,
block_id_flag: BlockIDFlag::Nil,
validator_address: Some(validator_address),
timestamp: Some(timestamp),
signature: Some(signature),
Expand All @@ -111,7 +111,7 @@ impl From<CommitSig> for RawCommitSig {
timestamp,
signature,
} => RawCommitSig {
block_id_flag: BlockIDFlag::BlockIDFlagCommit,
block_id_flag: BlockIDFlag::Commit,
validator_address: Some(validator_address),
timestamp: Some(timestamp),
signature: Some(signature),
Expand Down
2 changes: 1 addition & 1 deletion tendermint/src/lite_impl/signed_header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ impl lite::Commit for block::signed_header::SignedHeader {
if self.commit.signatures.len() != vals.validators().len() {
fail!(
Kind::ImplementationSpecific,
"pre-commit length: {} doesn't match validator length: {}",
"commit signatures count: {} doesn't match validators count: {}",
self.commit.signatures.len(),
vals.validators().len()
);
Expand Down
6 changes: 3 additions & 3 deletions tendermint/src/serializers/raw_commit_sig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ use std::str::FromStr;
#[repr(u8)]
pub enum BlockIDFlag {
/// vote is not included in the Commit.Precommits
BlockIDFlagAbsent = 1,
Absent = 1,
/// voted for the Commit.BlockID
BlockIDFlagCommit = 2,
Commit = 2,
/// voted for nil
BlockIDFlagNil = 3,
Nil = 3,
}

/// RawCommitSig struct for interim deserialization of JSON object
Expand Down