[][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: (PublicKey, SecretKey),
    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.

Panics

If the genesis block was not committed.

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

Returns the latest committed block.

pub fn pool_size(&self) -> u64[src]

Returns the transactions pool size.

pub fn get_saved_peers(&self) -> HashMap<PublicKey, Verified<Connect>>[src]

Returns Connect messages from peers saved in the cache, if any.

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

Returns reference to the transactions sender.

pub fn service_keypair(&self) -> &(PublicKey, SecretKey)[src]

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

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> 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 = !

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<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<T> Erased for T