[−][src]Struct rchain_v1::rchain::Blockchain
The actual Blockchain container
Fields
blocks: Vec<Block>
Stores all the blocks which are accepted already within the blockchain
accounts: HashMap<String, Account>
Lookup from AccountID (will be a public key later) to Account. Effectively, this represents the WorldState
pending_transactions: Vec<Transaction>
Will store transactions which should be added to the chain but aren't yet
Methods
impl Blockchain
[src]
pub fn new() -> Self
[src]
Constructor
pub fn append_block(&mut self, block: Block) -> Result<(), String>
[src]
Will add a block to the Blockchain @TODO every simple step could be refactored into a separate function for better testability and code-reusability
pub fn len(&self) -> usize
[src]
Will return the amount of blocks currently stored
pub fn get_last_block_hash(&self) -> Option<String>
[src]
Will return the hash of the last block
pub fn check_validity(&self) -> Result<(), String>
[src]
Checks if the blockchain was tempered with It will check until the first error happens and return a description of the problem if everything is fine it will return Ok
Trait Implementations
impl Clone for Blockchain
[src]
fn clone(&self) -> Blockchain
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for Blockchain
[src]
impl WorldState for Blockchain
[src]
fn get_user_ids(&self) -> Vec<String>
[src]
fn get_account_by_id_mut(&mut self, id: &String) -> Option<&mut Account>
[src]
fn get_account_by_id(&self, id: &String) -> Option<&Account>
[src]
fn create_account(
&mut self,
id: String,
account_type: AccountType
) -> Result<(), &'static str>
[src]
&mut self,
id: String,
account_type: AccountType
) -> Result<(), &'static str>
Auto Trait Implementations
impl RefUnwindSafe for Blockchain
impl Send for Blockchain
impl Sync for Blockchain
impl Unpin for Blockchain
impl UnwindSafe for Blockchain
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,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[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.
fn to_owned(&self) -> T
[src]
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.
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>,