cuprated/blockchain/manager/commands.rs
1//! This module contains the commands for the blockchain manager.
2use std::collections::HashMap;
3
4use monero_serai::block::Block;
5use tokio::sync::oneshot;
6
7use cuprate_types::TransactionVerificationData;
8
9/// The blockchain manager commands.
10pub enum BlockchainManagerCommand {
11 /// Attempt to add a new block to the blockchain.
12 AddBlock {
13 /// The [`Block`] to add.
14 block: Block,
15 /// All the transactions defined in [`Block::transactions`].
16 prepped_txs: HashMap<[u8; 32], TransactionVerificationData>,
17 /// The channel to send the response down.
18 response_tx: oneshot::Sender<Result<IncomingBlockOk, anyhow::Error>>,
19 },
20}
21
22/// The [`Ok`] response for an incoming block.
23pub enum IncomingBlockOk {
24 /// The block was added to the main-chain.
25 AddedToMainChain,
26 /// The blockchain manager is not ready yet.
27 NotReady,
28 /// The block was added to an alt-chain.
29 AddedToAltChain,
30 /// We already have the block.
31 AlreadyHave,
32}