[−][src]Struct damn_vuln_blockchain::chain::Chain
Ledger data-structure for the blockchain
Implementations
impl Chain
[src]
Chain supports the followings messages:
- AddBlock: adds a Block to the blockchain
- GetLastBlock: get's the latest Block in the blockchain
- DumpLedger: dumps the entire ledger
- ReplaceChain: replaces a Vec
inside the Chain data-structure, useful when synchronising ledgers
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]
&mut self,
block: Block,
network_size: usize
) -> ChainResult<usize>
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
fn started(&mut self, ctx: &mut Self::Context)
fn stopping(&mut self, ctx: &mut Self::Context) -> Running
fn stopped(&mut self, ctx: &mut Self::Context)
fn start(self) -> Addr<Self> where
Self: Actor<Context = Context<Self>>,
Self: Actor<Context = Context<Self>>,
fn start_default() -> Addr<Self> where
Self: Actor<Context = Context<Self>> + Default,
Self: Actor<Context = Context<Self>> + Default,
fn start_in_arbiter<F>(arb: &Arbiter, f: F) -> Addr<Self> where
F: FnOnce(&mut Context<Self>) -> Self + Send + 'static,
Self: Actor<Context = Context<Self>>,
F: FnOnce(&mut Context<Self>) -> Self + Send + 'static,
Self: Actor<Context = Context<Self>>,
fn create<F>(f: F) -> Addr<Self> where
F: FnOnce(&mut Context<Self>) -> Self,
Self: Actor<Context = Context<Self>>,
F: FnOnce(&mut Context<Self>) -> Self,
Self: Actor<Context = Context<Self>>,
impl Clone for Chain
[src]
impl Debug for Chain
[src]
impl<'de> Deserialize<'de> for Chain
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Handler<AddBlock> for Chain
[src]
type Result = MessageResult<AddBlock>
The type of value that this handler will return. Read more
fn handle(&mut self, msg: AddBlock, _ctx: &mut Self::Context) -> Self::Result
[src]
impl Handler<DumpLedger> for Chain
[src]
type Result = MessageResult<DumpLedger>
The type of value that this handler will return. Read more
fn handle(&mut self, _msg: DumpLedger, _ctx: &mut Self::Context) -> Self::Result
[src]
impl Handler<GetLastBlock> for Chain
[src]
type Result = MessageResult<GetLastBlock>
The type of value that this handler will return. Read more
fn handle(
&mut self,
_msg: GetLastBlock,
_ctx: &mut Self::Context
) -> Self::Result
[src]
&mut self,
_msg: GetLastBlock,
_ctx: &mut Self::Context
) -> Self::Result
impl Handler<ReplaceChain> for Chain
[src]
type Result = MessageResult<ReplaceChain>
The type of value that this handler will return. Read more
fn handle(
&mut self,
msg: ReplaceChain,
_ctx: &mut Self::Context
) -> Self::Result
[src]
&mut self,
msg: ReplaceChain,
_ctx: &mut Self::Context
) -> Self::Result
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,