Struct exonum::messages::Precommit
[−]
[src]
pub struct Precommit { /* fields omitted */ }
Pre-commit for a proposal.
Validation
A node panics if it has already sent a different Precommit
for the
same round.
Processing
Pre-commit is added to the list of known pre-commits. If a proposal is
unknown to the node, ProposeRequest
is sent in reply. If round
number from the message is bigger than a node's "locked round", then a
node replies with PrevotesRequest
. If there are unknown transactions,
then TransactionsRequest
is sent in reply. If a validator receives
+2/3 precommits for the same proposal with the same block_hash, then
block is executed and Status
is broadcast.
Generation
A node broadcasts Precommit
in response to Prevote
if there are +2/3
pre-votes and no unknown transactions.
Methods
impl Precommit
[src]
pub fn new(
validator: ValidatorId,
height: Height,
round: Round,
propose_hash: &Hash,
block_hash: &Hash,
time: SystemTime,
secret_key: &SecretKey
) -> Precommit
[src]
validator: ValidatorId,
height: Height,
round: Round,
propose_hash: &Hash,
block_hash: &Hash,
time: SystemTime,
secret_key: &SecretKey
) -> Precommit
Creates message and signs it.
pub fn new_with_signature(
validator: ValidatorId,
height: Height,
round: Round,
propose_hash: &Hash,
block_hash: &Hash,
time: SystemTime,
signature: &Signature
) -> Precommit
[src]
validator: ValidatorId,
height: Height,
round: Round,
propose_hash: &Hash,
block_hash: &Hash,
time: SystemTime,
signature: &Signature
) -> Precommit
Creates message and appends existing signature.
pub fn to_hex(&self) -> String
[src]
Returns the hex representation of the binary data. Lower case letters are used (e.g. f9b4ca).
pub fn validator(&self) -> ValidatorId
[src]
The validator id.
pub fn height(&self) -> Height
[src]
The height to which the message is related.
pub fn round(&self) -> Round
[src]
The round to which the message is related.
pub fn propose_hash(&self) -> &Hash
[src]
Hash of the corresponding Propose
.
pub fn block_hash(&self) -> &Hash
[src]
Hash of the new block.
pub fn time(&self) -> SystemTime
[src]
Time of the Precommit
.
Trait Implementations
impl Clone for Precommit
[src]
fn clone(&self) -> Precommit
[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 Precommit
[src]
fn eq(&self, __arg_0: &Precommit) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Precommit) -> bool
[src]
This method tests for !=
.
impl ServiceMessage for Precommit
[src]
const SERVICE_ID: u16
SERVICE_ID: u16 = CONSENSUS
ID of the service this message belongs to.
const MESSAGE_ID: u16
MESSAGE_ID: u16 = 0 + 1 + 1 + 1 + 1
ID of the message itself. Should be unique within a service. Read more
impl Message for Precommit
[src]
fn from_raw(raw: RawMessage) -> Result<Precommit, Error>
[src]
Converts the raw message into the specific one.
fn raw(&self) -> &RawMessage
[src]
Returns raw message.
fn verify_signature(&self, pub_key: &PublicKey) -> bool
[src]
Verifies the message using given public key.
impl<'a> SegmentField<'a> for Precommit
[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 AsRef<RawMessage> for Precommit
[src]
fn as_ref(&self) -> &RawMessage
[src]
Performs the conversion.
impl FromHex for Precommit
[src]
type Error = Error
fn from_hex<T: AsRef<[u8]>>(hex: T) -> Result<Self, Self::Error>
[src]
Creates an instance of type Self
from the given hex string, or fails with a custom error type. Read more
impl StorageValue for Precommit
[src]
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 Precommit
[src]
fn fmt(&self, fmt: &mut Formatter) -> Result<(), Error>
[src]
Formats the value using the given formatter. Read more
impl ExonumJson for Precommit
[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 + Send + Sync>>
[src]
serialize field as json::Value
impl ExonumJsonDeserialize for Precommit
[src]
impl<'de> Deserialize<'de> for Precommit
[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 Precommit
[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 Precommit
[src]
fn validator(&self) -> ValidatorId
[src]
Return validator if of the message.