[][src]Struct exonum::blockchain::Blockchain

pub struct Blockchain { /* fields omitted */ }

Shared Exonum blockchain instance.

This is essentially a smart pointer to shared blockchain resources (storage, cryptographic keys, and a sender of transactions). It can be converted into a BlockchainMut instance, which combines these resources with behavior (i.e., a set of services).

Methods

impl Blockchain[src]

pub fn new(
    database: impl Into<Arc<dyn Database>>,
    service_keypair: impl Into<KeyPair>,
    api_sender: ApiSender
) -> Self
[src]

Constructs a blockchain for the given database.

pub fn build_for_tests() -> Self[src]

Creates a non-persisting blockchain, all data in which is irrevocably lost on drop.

The created blockchain cannot send transactions; an attempt to do so will result in an error.

pub fn snapshot(&self) -> Box<dyn Snapshot>[src]

Creates a read-only snapshot of the current storage state.

pub fn last_hash(&self) -> Hash[src]

Returns the hash of the latest committed block. If genesis block was not committed returns Hash::zero().

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

Returns the latest committed block.

pub fn sender(&self) -> &ApiSender[src]

Returns reference to the transactions sender.

pub fn service_keypair(&self) -> &KeyPair[src]

Returns reference to the service key pair of the current node.

pub fn check_tx(
    snapshot: &dyn Snapshot,
    tx: &Verified<AnyTx>
) -> Result<(), ExecutionError>
[src]

Performs several shallow checks that transaction is correct.

Returned Ok(()) value doesn't necessarily mean that transaction is correct and will be executed successfully, but returned Err(..) value means that this transaction is obviously incorrect and should be declined as early as possible.

Trait Implementations

impl AsRef<Blockchain> for BlockchainMut[src]

impl Clone for Blockchain[src]

impl Debug for Blockchain[src]

Auto Trait Implementations

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> From<T> for T[src]

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

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