blockchain/
lib.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#![forbid(unsafe_code)]

pub mod block;
pub mod chain;
pub mod transaction;
pub mod wallet;

pub use block::*;
pub use chain::*;
use serde::{Deserialize, Serialize};
use thiserror::Error;
pub use transaction::*;
pub use wallet::*;

/// Blockchain error.
#[derive(Debug, Error, Serialize, Deserialize, PartialEq)]
pub enum BlockchainError {
    /// Transaction not found.
    #[error("Transaction not found.")]
    TransactionNotFound,

    /// Transaction is invalid.
    #[error("Invalid transaction.")]
    InvalidTransaction,

    /// Invalid configuration during blockchain creation.
    #[error("Invalid configuration during blockchain creation.")]
    InvalidConfiguration,

    /// Insufficient funds.
    #[error("Insufficient funds.")]
    InsufficientFunds,

    /// Wallet not found.
    #[error("Wallet not found.")]
    WalletNotFound,
}