Struct exonum::blockchain::Block
[−]
[src]
pub struct Block { /* fields omitted */ }
Exonum block 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.
Methods
impl Block
[src]
fn new(
schema_version: u16,
proposer_id: u16,
height: u64,
tx_count: u32,
prev_hash: &Hash,
tx_hash: &Hash,
state_hash: &Hash
) -> Block
[src]
schema_version: u16,
proposer_id: u16,
height: u64,
tx_count: u32,
prev_hash: &Hash,
tx_hash: &Hash,
state_hash: &Hash
) -> Block
Creates a new instance with given parameters.
fn hash(&self) -> Hash
[src]
Hashes data as a raw byte array and returns the resulting hash.
fn schema_version(&self) -> u16
[src]
Information schema version.
fn proposer_id(&self) -> u16
[src]
Block proposer id.
fn height(&self) -> u64
[src]
Height of the committed block
fn tx_count(&self) -> u32
[src]
Number of transactions in block.
fn prev_hash(&self) -> &Hash
[src]
Hash link to the previous block in blockchain.
fn tx_hash(&self) -> &Hash
[src]
Root hash of merkle tree of current block transactions.
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 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.
fn hash(&self) -> Hash
[src]
Returns a hash of the value. Read more
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