blockchain/
lib.rs

1#![forbid(unsafe_code)]
2
3pub mod block;
4pub mod chain;
5pub mod transaction;
6pub mod wallet;
7
8pub use block::*;
9pub use chain::*;
10use serde::{Deserialize, Serialize};
11use thiserror::Error;
12pub use transaction::*;
13pub use wallet::*;
14
15/// Blockchain error.
16#[derive(Debug, Error, Serialize, Deserialize, PartialEq)]
17pub enum BlockchainError {
18    /// Transaction not found.
19    #[error("Transaction not found.")]
20    TransactionNotFound,
21
22    /// Transaction is invalid.
23    #[error("Invalid transaction.")]
24    InvalidTransaction,
25
26    /// Invalid configuration during blockchain creation.
27    #[error("Invalid configuration during blockchain creation.")]
28    InvalidConfiguration,
29
30    /// Insufficient funds.
31    #[error("Insufficient funds.")]
32    InsufficientFunds,
33
34    /// Wallet not found.
35    #[error("Wallet not found.")]
36    WalletNotFound,
37}