pub struct Vote {
pub vote_type: Type,
pub height: Height,
pub round: Round,
pub block_id: Option<Id>,
pub timestamp: Option<Time>,
pub validator_address: Id,
pub validator_index: ValidatorIndex,
pub signature: Option<Signature>,
pub extension: Vec<u8>,
pub extension_signature: Option<Signature>,
}
Expand description
Votes are signed messages from validators for a particular block which include information about the validator signing it.
Fields§
§vote_type: Type
Type of vote (prevote or precommit)
height: Height
Block height
round: Round
Round
block_id: Option<Id>
Block ID
timestamp: Option<Time>
Timestamp
validator_address: Id
Validator address
validator_index: ValidatorIndex
Validator index
signature: Option<Signature>
Signature
extension: Vec<u8>
Vote extension provided by the application. Only valid for precommit messages.
This field has been added in CometBFT 0.38 and will be ignored when encoding into earlier protocol versions.
extension_signature: Option<Signature>
Vote extension signature by the validator Only valid for precommit messages.
This field has been added in CometBFT 0.38 and will be ignored when encoding into earlier protocol versions.
Implementations§
Source§impl Vote
impl Vote
Sourcepub fn is_prevote(&self) -> bool
pub fn is_prevote(&self) -> bool
Is this vote a prevote?
Sourcepub fn is_precommit(&self) -> bool
pub fn is_precommit(&self) -> bool
Is this vote a precommit?
Sourcepub fn header_hash(&self) -> Option<Hash>
pub fn header_hash(&self) -> Option<Hash>
Returns block_id.hash
Sourcepub fn to_signable_bytes<B>(
&self,
chain_id: ChainId,
sign_bytes: &mut B,
) -> Result<bool, ProtobufError>where
B: BufMut,
pub fn to_signable_bytes<B>(
&self,
chain_id: ChainId,
sign_bytes: &mut B,
) -> Result<bool, ProtobufError>where
B: BufMut,
Create signable bytes from Vote.
Sourcepub fn into_signable_vec(self, chain_id: ChainId) -> Vec<u8> ⓘ
pub fn into_signable_vec(self, chain_id: ChainId) -> Vec<u8> ⓘ
Create signable vector from Vote.
Sourcepub fn consensus_state(&self) -> State
👎Deprecated since 0.17.0: This seems unnecessary, please raise it to the team, if you need it.
pub fn consensus_state(&self) -> State
Consensus state from this vote - This doesn’t seem to be used anywhere.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Vote
impl<'de> Deserialize<'de> for Vote
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Protobuf<Vote> for Vote
impl Protobuf<Vote> for Vote
§fn encode<B>(self, buf: &mut B) -> Result<(), Error>where
B: BufMut,
fn encode<B>(self, buf: &mut B) -> Result<(), Error>where
B: BufMut,
§fn encode_length_delimited<B>(self, buf: &mut B) -> Result<(), Error>where
B: BufMut,
fn encode_length_delimited<B>(self, buf: &mut B) -> Result<(), Error>where
B: BufMut,
§fn decode<B>(buf: B) -> Result<Self, Error>where
B: Buf,
fn decode<B>(buf: B) -> Result<Self, Error>where
B: Buf,
§fn decode_length_delimited<B>(buf: B) -> Result<Self, Error>where
B: Buf,
fn decode_length_delimited<B>(buf: B) -> Result<Self, Error>where
B: Buf,
§fn encoded_len(self) -> usize
fn encoded_len(self) -> usize
§fn encode_vec(self) -> Vec<u8> ⓘ
fn encode_vec(self) -> Vec<u8> ⓘ
Vec<u8>
.§fn decode_vec(v: &[u8]) -> Result<Self, Error>
fn decode_vec(v: &[u8]) -> Result<Self, Error>
Vec<u8>
(or equivalent).§fn encode_length_delimited_vec(self) -> Vec<u8> ⓘ
fn encode_length_delimited_vec(self) -> Vec<u8> ⓘ
Vec<u8>
Protobuf-encoded message.§fn decode_length_delimited_vec(v: &[u8]) -> Result<Self, Error>
fn decode_length_delimited_vec(v: &[u8]) -> Result<Self, Error>
Vec<u8>
or equivalent.Source§impl Protobuf<Vote> for Vote
impl Protobuf<Vote> for Vote
§fn encode<B>(self, buf: &mut B) -> Result<(), Error>where
B: BufMut,
fn encode<B>(self, buf: &mut B) -> Result<(), Error>where
B: BufMut,
§fn encode_length_delimited<B>(self, buf: &mut B) -> Result<(), Error>where
B: BufMut,
fn encode_length_delimited<B>(self, buf: &mut B) -> Result<(), Error>where
B: BufMut,
§fn decode<B>(buf: B) -> Result<Self, Error>where
B: Buf,
fn decode<B>(buf: B) -> Result<Self, Error>where
B: Buf,
§fn decode_length_delimited<B>(buf: B) -> Result<Self, Error>where
B: Buf,
fn decode_length_delimited<B>(buf: B) -> Result<Self, Error>where
B: Buf,
§fn encoded_len(self) -> usize
fn encoded_len(self) -> usize
§fn encode_vec(self) -> Vec<u8> ⓘ
fn encode_vec(self) -> Vec<u8> ⓘ
Vec<u8>
.§fn decode_vec(v: &[u8]) -> Result<Self, Error>
fn decode_vec(v: &[u8]) -> Result<Self, Error>
Vec<u8>
(or equivalent).§fn encode_length_delimited_vec(self) -> Vec<u8> ⓘ
fn encode_length_delimited_vec(self) -> Vec<u8> ⓘ
Vec<u8>
Protobuf-encoded message.§fn decode_length_delimited_vec(v: &[u8]) -> Result<Self, Error>
fn decode_length_delimited_vec(v: &[u8]) -> Result<Self, Error>
Vec<u8>
or equivalent.Source§impl Protobuf<Vote> for Vote
impl Protobuf<Vote> for Vote
§fn encode<B>(self, buf: &mut B) -> Result<(), Error>where
B: BufMut,
fn encode<B>(self, buf: &mut B) -> Result<(), Error>where
B: BufMut,
§fn encode_length_delimited<B>(self, buf: &mut B) -> Result<(), Error>where
B: BufMut,
fn encode_length_delimited<B>(self, buf: &mut B) -> Result<(), Error>where
B: BufMut,
§fn decode<B>(buf: B) -> Result<Self, Error>where
B: Buf,
fn decode<B>(buf: B) -> Result<Self, Error>where
B: Buf,
§fn decode_length_delimited<B>(buf: B) -> Result<Self, Error>where
B: Buf,
fn decode_length_delimited<B>(buf: B) -> Result<Self, Error>where
B: Buf,
§fn encoded_len(self) -> usize
fn encoded_len(self) -> usize
§fn encode_vec(self) -> Vec<u8> ⓘ
fn encode_vec(self) -> Vec<u8> ⓘ
Vec<u8>
.§fn decode_vec(v: &[u8]) -> Result<Self, Error>
fn decode_vec(v: &[u8]) -> Result<Self, Error>
Vec<u8>
(or equivalent).§fn encode_length_delimited_vec(self) -> Vec<u8> ⓘ
fn encode_length_delimited_vec(self) -> Vec<u8> ⓘ
Vec<u8>
Protobuf-encoded message.§fn decode_length_delimited_vec(v: &[u8]) -> Result<Self, Error>
fn decode_length_delimited_vec(v: &[u8]) -> Result<Self, Error>
Vec<u8>
or equivalent.