[][src]Struct damn_vuln_blockchain::block::Block

pub struct Block { /* fields omitted */ }

Smallest data-sctructure that can go into Chain.

NOTE: tx, prev, validator and rx are Option<_> to accomodate genesis block. Blockchain implementors must check for the existence of genesis block before appending the block to the ledger

Implementations

impl Block[src]

pub fn to_string(&self) -> String[src]

Get block info as string

pub fn genesis() -> Block[src]

creates genesis block

pub fn is_genesis(&self) -> bool[src]

checks if the block is a genesis block

pub fn hash(&self) -> String[src]

computes the hash of a block, uses the same logic for genesis blocks, it simply returns the hash stored in the block as genesis() computes hash over random strings

pub fn get_prev(&self) -> Option<&String>[src]

get hash of previous block

pub fn get_asset_id(&self) -> Option<&String>[src]

get hash of previous block

pub fn get_hash(&self) -> &str[src]

get hash of block

pub fn get_serial_no(&self) -> Option<usize>[src]

get serial numbr of block

pub fn set_serial_no(&mut self, serial_no: usize)[src]

set serial_no of block

pub fn get_rx(&self) -> Option<&String>[src]

get receiver involved in the transaction that lead tot the creation of this block

pub fn get_validator(&self) -> Option<&String>[src]

get validator involved in the creation of this block

pub fn get_tx(&self) -> Option<&String>[src]

get sender involved in the transaction that lead tot the creation of this block

Trait Implementations

impl Clone for Block[src]

impl Debug for Block[src]

impl Default for Block[src]

impl<'de> Deserialize<'de> for Block[src]

impl Display for Block[src]

impl Serialize for Block[src]

Auto Trait Implementations

impl RefUnwindSafe for Block

impl Send for Block

impl Sync for Block

impl Unpin for Block

impl UnwindSafe for Block

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> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

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

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

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

impl<T> Same<T> for T

type Output = T

Should always be Self

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

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

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<V, T> VZip<V> for T where
    V: MultiLane<T>,