Struct exonum::blockchain::Block
[−]
[src]
pub struct Block { /* fields omitted */ }
Exonum block header data structure.
Block is essentially a list of transactions, which is a result of the consensus algorithm (thus authenticated by the supermajority of validators) and is applied atomically to the blockchain state.
Header only contains the amount of transactions and the transactions root hash as well as other information, but not the transactions themselves.
Methods
impl Block
[src]
pub fn new(
schema_version: u16,
proposer_id: ValidatorId,
height: Height,
tx_count: u32,
prev_hash: &Hash,
tx_hash: &Hash,
state_hash: &Hash
) -> Block
[src]
schema_version: u16,
proposer_id: ValidatorId,
height: Height,
tx_count: u32,
prev_hash: &Hash,
tx_hash: &Hash,
state_hash: &Hash
) -> Block
Creates a new instance with given parameters.
pub fn schema_version(&self) -> u16
[src]
Information schema version.
pub fn proposer_id(&self) -> ValidatorId
[src]
Block proposer id.
pub fn height(&self) -> Height
[src]
Height of the committed block
pub fn tx_count(&self) -> u32
[src]
Number of transactions in block.
pub fn prev_hash(&self) -> &Hash
[src]
Hash link to the previous block in blockchain.
pub fn tx_hash(&self) -> &Hash
[src]
Root hash of merkle tree of current block transactions.
pub fn state_hash(&self) -> &Hash
[src]
Hash of the current exonum
state after applying transactions in the block.
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<'a> Field<'a> for Block
[src]
unsafe fn read(buffer: &'a [u8], from: Offset, to: Offset) -> Self
[src]
Read Field from buffer, with given position, beware of memory unsafety, you should check
Field
before read
. Read more
fn write(&self, buffer: &mut Vec<u8>, from: Offset, to: Offset)
[src]
Write Field to buffer, in given position write
doesn't lead to memory unsafety. Read more
fn check(
buffer: &'a [u8],
from_st_val: CheckedOffset,
to_st_val: CheckedOffset,
latest_segment: CheckedOffset
) -> Result
[src]
buffer: &'a [u8],
from_st_val: CheckedOffset,
to_st_val: CheckedOffset,
latest_segment: CheckedOffset
) -> Result
Checks if data in the buffer could be deserialized. Returns an index of latest data seen. Read more
fn field_size() -> Offset
[src]
Field's header size
impl CryptoHash for Block
[src]
impl StorageValue for Block
[src]
fn into_bytes(self) -> Vec<u8>
[src]
Serialize a value into a vector of bytes.
fn from_bytes(v: 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. Read more
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 + Send + Sync>>
[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