1cfg_if::cfg_if! {
11 if #[cfg(test)] {
13 use cuprate_test_utils as _;
14 use curve25519_dalek as _;
15 use hex_literal as _;
16 use futures as _;
17 }
18}
19
20use cuprate_consensus_rules::ConsensusError;
21
22pub mod batch_verifier;
23pub mod block;
24#[cfg(test)]
25mod tests;
26pub mod transactions;
27
28pub use cuprate_consensus_context::{
29 initialize_blockchain_context, BlockChainContextRequest, BlockChainContextResponse,
30 BlockchainContext, BlockchainContextService, ContextConfig,
31};
32
33pub use cuprate_consensus_rules::genesis::generate_genesis_block;
35pub use cuprate_types::{
36 blockchain::{BlockchainReadRequest, BlockchainResponse},
37 HardFork,
38};
39
40#[derive(Debug, thiserror::Error)]
42#[expect(variant_size_differences)]
43pub enum ExtendedConsensusError {
44 #[error("{0}")]
46 ConErr(#[from] ConsensusError),
47 #[error("Database error: {0}")]
49 DBErr(#[from] tower::BoxError),
50 #[error("The transactions passed in with the block are incorrect.")]
52 TxsIncludedWithBlockIncorrect,
53 #[error("One or more statements in the batch verifier was invalid.")]
55 OneOrMoreBatchVerificationStatementsInvalid,
56 #[error("A request to verify a batch of blocks had no blocks in the batch.")]
58 NoBlocksToVerify,
59}
60
61use __private::Database;
62
63pub mod __private {
64 use cuprate_types::blockchain::{BlockchainReadRequest, BlockchainResponse};
65
66 pub trait Database:
74 tower::Service<
75 BlockchainReadRequest,
76 Response = BlockchainResponse,
77 Error = tower::BoxError,
78 Future: Send + 'static,
79 >
80 {
81 }
82
83 impl<
84 T: tower::Service<
85 BlockchainReadRequest,
86 Response = BlockchainResponse,
87 Error = tower::BoxError,
88 Future: Send + 'static,
89 >,
90 > Database for T
91 {
92 }
93}