Struct exonum::messages::Block
[−]
[src]
pub struct Block { /* fields omitted */ }
Information about a block.
Validation
The message is ignored if
* its to
field corresponds to a different node
* the block
, transaction
and precommits
fields cannot be parsed or verified
Processing
The block is added to the blockchain.
Generation
The message is sent as response to RequestBlock
.
Methods
impl Block
[src]
fn new(
from: &PublicKey,
to: &PublicKey,
block: Block,
precommits: Vec<Precommit>,
transactions: Vec<RawMessage>,
secret_key: &SecretKey
) -> Block
[src]
from: &PublicKey,
to: &PublicKey,
block: Block,
precommits: Vec<Precommit>,
transactions: Vec<RawMessage>,
secret_key: &SecretKey
) -> Block
Creates messsage and sign it.
fn new_with_signature(
from: &PublicKey,
to: &PublicKey,
block: Block,
precommits: Vec<Precommit>,
transactions: Vec<RawMessage>,
signature: &Signature
) -> Block
[src]
from: &PublicKey,
to: &PublicKey,
block: Block,
precommits: Vec<Precommit>,
transactions: Vec<RawMessage>,
signature: &Signature
) -> Block
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 from(&self) -> &PublicKey
[src]
The sender's public key.
fn to(&self) -> &PublicKey
[src]
Public key of the recipient.
fn block(&self) -> Block
[src]
Block.
fn precommits(&self) -> Vec<Precommit>
[src]
List of pre-commits.
fn transactions(&self) -> Vec<RawMessage>
[src]
List of the transactions.
Trait Implementations
impl Clone for Block
[src]
fn clone(&self) -> Block
[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 Block
[src]
fn eq(&self, __arg_0: &Block) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Block) -> bool
[src]
This method tests for !=
.
impl Message for Block
[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 Block
[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 Block
[src]
fn from_raw(raw: RawMessage) -> Result<Block, Error>
[src]
Converts the raw message into the specific one.
impl StorageValue for Block
[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 Block
[src]
fn fmt(&self, fmt: &mut Formatter) -> Result<(), Error>
[src]
Formats the value using the given formatter.
impl ExonumJson for Block
[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 Block
[src]
impl<'de> Deserialize<'de> for Block
[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