pub struct Blockchain {
pub blocks: Vec<Block>,
/* private fields */
}
Expand description
Collection of related blocks as the same as linked lists In this program logic of POW algorithm have used.
Fields§
§blocks: Vec<Block>
Implementations§
Source§impl Blockchain
impl Blockchain
pub fn new() -> Self
Sourcepub fn blockchain_update_with_block(
&mut self,
block: Block,
) -> Result<&Vec<Block>, CustomError>
pub fn blockchain_update_with_block( &mut self, block: Block, ) -> Result<&Vec<Block>, CustomError>
In the update_with_block() checking for (+)Overspending, (+)Double Spending, (-)Impersonate.
Define BlockValidationError for violation of the rules POW
Call input and output hash function
Retain unspent_outputs of the Blockchain
Trait Implementations§
Source§impl Debug for Blockchain
impl Debug for Blockchain
Source§impl Default for Blockchain
impl Default for Blockchain
Auto Trait Implementations§
impl Freeze for Blockchain
impl RefUnwindSafe for Blockchain
impl Send for Blockchain
impl Sync for Blockchain
impl Unpin for Blockchain
impl UnwindSafe for Blockchain
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more