tendermint/abci/request/
verify_vote_extension.rs

1use crate::{account, block, Hash};
2use bytes::Bytes;
3
4#[doc = include_str!("../doc/request-verifyvoteextension.md")]
5#[derive(Clone, PartialEq, Eq, Debug)]
6pub struct VerifyVoteExtension {
7    pub hash: Hash,
8    pub validator_address: account::Id,
9    pub height: block::Height,
10    pub vote_extension: Bytes,
11}
12
13// =============================================================================
14// Protobuf conversions
15// =============================================================================
16
17mod v0_38 {
18    use super::VerifyVoteExtension;
19    use tendermint_proto::v0_38 as pb;
20    use tendermint_proto::Protobuf;
21
22    impl From<VerifyVoteExtension> for pb::abci::RequestVerifyVoteExtension {
23        fn from(value: VerifyVoteExtension) -> Self {
24            Self {
25                hash: value.hash.into(),
26                validator_address: value.validator_address.into(),
27                height: value.height.into(),
28                vote_extension: value.vote_extension,
29            }
30        }
31    }
32
33    impl TryFrom<pb::abci::RequestVerifyVoteExtension> for VerifyVoteExtension {
34        type Error = crate::Error;
35
36        fn try_from(message: pb::abci::RequestVerifyVoteExtension) -> Result<Self, Self::Error> {
37            Ok(Self {
38                hash: message.hash.try_into()?,
39                validator_address: message.validator_address.try_into()?,
40                height: message.height.try_into()?,
41                vote_extension: message.vote_extension,
42            })
43        }
44    }
45
46    impl Protobuf<pb::abci::RequestVerifyVoteExtension> for VerifyVoteExtension {}
47}