[][src]Struct damn_vuln_blockchain::chain::Chain

pub struct Chain { /* fields omitted */ }

Ledger data-structure for the blockchain

Implementations

impl Chain[src]

Chain supports the followings messages:

pub fn new(name: &str) -> Chain[src]

create new blockchain

pub fn get_last_block(&self) -> &Block[src]

get the last block in the chain

pub fn add_block(
    &mut self,
    block: Block,
    network_size: usize
) -> ChainResult<usize>
[src]

add a block to the chain ChainError::GenesisBlockAdditionError error is returned when a genesis block is passed. Genesis blocks are only valid when a chain is created.

pub fn is_valid(chain: &Vec<Block>) -> ChainResult<()>[src]

checks if a blockchain is valid by comparing the hash of the previous element with the block.prev of the next element in the blockchain

pub fn replace_chain(&mut self, chain: Vec<Block>) -> ChainResult<()>[src]

Trait Implementations

impl Actor for Chain[src]

type Context = Context<Self>

Actor execution context type

impl Clone for Chain[src]

impl Debug for Chain[src]

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

impl Handler<AddBlock> for Chain[src]

type Result = MessageResult<AddBlock>

The type of value that this handler will return. Read more

impl Handler<DumpLedger> for Chain[src]

type Result = MessageResult<DumpLedger>

The type of value that this handler will return. Read more

impl Handler<GetLastBlock> for Chain[src]

type Result = MessageResult<GetLastBlock>

The type of value that this handler will return. Read more

impl Handler<ReplaceChain> for Chain[src]

type Result = MessageResult<ReplaceChain>

The type of value that this handler will return. Read more

impl Serialize for Chain[src]

Auto Trait Implementations

impl RefUnwindSafe for Chain

impl Send for Chain

impl Sync for Chain

impl Unpin for Chain

impl UnwindSafe for Chain

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, 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>,