[−][src]Struct exonum::blockchain::Blockchain
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]
database: impl Into<Arc<dyn Database>>,
service_keypair: impl Into<KeyPair>,
api_sender: ApiSender
) -> Self
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]
snapshot: &dyn Snapshot,
tx: &Verified<AnyTx>
) -> Result<(), ExecutionError>
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]
fn as_ref(&self) -> &Blockchain
[src]
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]
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> 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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
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>,