[][src]Struct pbft_engine::message_type::ParsedMessage

pub struct ParsedMessage {
    pub header_bytes: Vec<u8>,
    pub header_signature: Vec<u8>,
    pub message: PbftMessageWrapper,
    pub message_bytes: Vec<u8>,
    pub from_self: bool,
}

Container for a received PeerMessage and the PBFT message parsed from it

The bits of the PeerMessage struct that this carries around are used in constructing signed votes.

Fields

header_bytes: Vec<u8>

Serialized ConsensusPeerMessageHeader. Inserted into a signed vote.

header_signature: Vec<u8>

Signature for header_bytes. Inserted into a signed vote.

message: PbftMessageWrapper

The parsed PBFT message.

message_bytes: Vec<u8>

The serialized PBFT message. Inserted into a signed vote.

from_self: bool

Whether or not this message was self-constructed. Self-constructed messages are skipped when assembling signed votes, since PBFT doesn't have access to the validator key necessary to create valid signed messages.

Implementations

impl ParsedMessage[src]

pub fn from_peer_message(
    message: PeerMessage,
    own_id: &[u8]
) -> Result<Self, PbftError>
[src]

Constructs a ParsedMessage from the given PeerMessage.

Attempts to parse the message contents as a PbftMessage, PbftNewView, or PbftSeal and wraps that in an internal enum.

pub fn from_pbft_message(message: PbftMessage) -> Result<Self, PbftError>[src]

Constructs a ParsedMessage from the given PbftMessage.

Does not add metadata necessary for creating a signed vote from this message.

pub fn from_new_view_message(message: PbftNewView) -> Result<Self, PbftError>[src]

Constructs a ParsedMessage from the given PbftNewView.

Does not add metadata necessary for creating a signed vote from this message.

pub fn from_signed_vote(vote: &PbftSignedVote) -> Result<Self, PbftError>[src]

Constructs a ParsedMessage from the given PbftSignedVote.

Adds metadata necessary for re-creating a signed vote later on.

pub fn info(&self) -> &PbftMessageInfo[src]

pub fn get_block_id(&self) -> BlockId[src]

Returns the BlockId for this message's wrapped PbftMessage.

Panics

  • If the wrapped message is a NewView or Seal, which don't contain a block_id

pub fn get_new_view_message(&self) -> &PbftNewView[src]

Returns the wrapped PbftNewView.

Panics

  • If the wrapped message is a regular message or Seal, not a NewView

pub fn get_seal(&self) -> &PbftSeal[src]

Returns the wrapped PbftSeal.

Panics

  • If the wrapped message is a regular message or NewView

Trait Implementations

impl Clone for ParsedMessage[src]

impl Debug for ParsedMessage[src]

impl Eq for ParsedMessage[src]

impl Hash for ParsedMessage[src]

impl PartialEq<ParsedMessage> for ParsedMessage[src]

impl StructuralEq for ParsedMessage[src]

impl StructuralPartialEq for ParsedMessage[src]

Auto Trait Implementations

impl RefUnwindSafe for ParsedMessage

impl Send for ParsedMessage

impl Sync for ParsedMessage

impl Unpin for ParsedMessage

impl UnwindSafe for ParsedMessage

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> CloneAny for T where
    T: Clone + Any

impl<T> DebugAny for T where
    T: Any + Debug

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> UnsafeAny for T where
    T: Any