Struct exonum::messages::Prevote
[−]
[src]
pub struct Prevote { /* fields omitted */ }
Pre-vote for a new block.
Validation
A node panics if it has already sent a different Prevote
for the same round.
Processing
Pre-vote is added to the list of known votes for the same proposal.
If locked_round
number from the message is bigger than in a node state, then a node replies
with RequestPrevotes
.
If there are unknown transactions in the propose specified by propose_hash
,
RequestTransactions
is sent in reply.
Otherwise if all transactions are known and there are +2/3 pre-votes, then a node is locked
to that proposal and Precommit
is broadcast.
Generation
A node broadcasts Prevote
in response to Propose
when it has received all the transactions.
Methods
impl Prevote
[src]
fn new(
validator: u16,
height: u64,
round: u32,
propose_hash: &Hash,
locked_round: u32,
secret_key: &SecretKey
) -> Prevote
[src]
validator: u16,
height: u64,
round: u32,
propose_hash: &Hash,
locked_round: u32,
secret_key: &SecretKey
) -> Prevote
Creates messsage and sign it.
fn new_with_signature(
validator: u16,
height: u64,
round: u32,
propose_hash: &Hash,
locked_round: u32,
signature: &Signature
) -> Prevote
[src]
validator: u16,
height: u64,
round: u32,
propose_hash: &Hash,
locked_round: u32,
signature: &Signature
) -> Prevote
Creates message and appends existing signature.
fn message_id() -> u16
[src]
Returns message_id
useable for matching.
fn service_id() -> u16
[src]
Returns service_id
useable for matching.
fn validator(&self) -> u16
[src]
The validator id.
fn height(&self) -> u64
[src]
The height to which the message is related.
fn round(&self) -> u32
[src]
The round to which the message is related.
fn propose_hash(&self) -> &Hash
[src]
Hash of the corresponding Propose
.
fn locked_round(&self) -> u32
[src]
Locked round.
Trait Implementations
impl Clone for Prevote
[src]
fn clone(&self) -> Prevote
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl PartialEq for Prevote
[src]
fn eq(&self, __arg_0: &Prevote) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Prevote) -> bool
[src]
This method tests for !=
.
impl Message for Prevote
[src]
fn raw(&self) -> &RawMessage
[src]
Returns raw message.
fn hash(&self) -> Hash
[src]
Returns hash of the RawMessage
.
fn verify_signature(&self, pub_key: &PublicKey) -> bool
[src]
Verifies the message using given public key.
impl<'a> SegmentField<'a> for Prevote
[src]
fn item_size() -> Offset
[src]
size of item fixed part that this Field
collect.
fn count(&self) -> Offset
[src]
count of items in collection
fn extend_buffer(&self, buffer: &mut Vec<u8>)
[src]
extend buffer with this collection
unsafe fn from_buffer(buffer: &'a [u8], from: Offset, count: Offset) -> Self
[src]
create collection from buffer
fn check_data(
buffer: &'a [u8],
from: CheckedOffset,
count: CheckedOffset,
latest_segment: CheckedOffset
) -> Result
[src]
buffer: &'a [u8],
from: CheckedOffset,
count: CheckedOffset,
latest_segment: CheckedOffset
) -> Result
check collection data
impl FromRaw for Prevote
[src]
fn from_raw(raw: RawMessage) -> Result<Prevote, Error>
[src]
Converts the raw message into the specific one.
impl StorageValue for Prevote
[src]
fn hash(&self) -> Hash
[src]
Returns a hash of the value. Read more
fn into_bytes(self) -> Vec<u8>
[src]
Serialize a value into a vector of bytes.
fn from_bytes(value: Cow<[u8]>) -> Self
[src]
Deserialize a value from bytes.
impl Debug for Prevote
[src]
fn fmt(&self, fmt: &mut Formatter) -> Result<(), Error>
[src]
Formats the value using the given formatter.
impl ExonumJson for Prevote
[src]
fn deserialize_field<B>(
value: &Value,
buffer: &mut B,
from: Offset,
to: Offset
) -> Result<(), Box<Error>> where
B: WriteBufferWrapper,
[src]
value: &Value,
buffer: &mut B,
from: Offset,
to: Offset
) -> Result<(), Box<Error>> where
B: WriteBufferWrapper,
write deserialized field in buffer on place.
fn serialize_field(&self) -> Result<Value, Box<Error>>
[src]
serialize field as json::Value
impl ExonumJsonDeserialize for Prevote
[src]
impl<'de> Deserialize<'de> for Prevote
[src]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
[src]
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Serialize for Prevote
[src]
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where
S: Serializer,
[src]
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl VoteMessage for Prevote
[src]
fn validator(&self) -> ValidatorId
[src]
Return validator if of the message.