cuprate_dandelion_tower/
traits.rs

1/// A request to diffuse a transaction to all connected peers.
2///
3/// This crate does not handle diffusion it is left to implementers.
4pub struct DiffuseRequest<Tx>(pub Tx);
5
6/// A request sent to a single peer to stem this transaction.
7pub struct StemRequest<Tx>(pub Tx);
8
9#[cfg(feature = "txpool")]
10/// A request sent to the backing transaction pool storage.
11pub enum TxStoreRequest<TxId> {
12    /// A request to retrieve a `Tx` with the given Id from the pool, should not remove that tx from the pool.
13    ///
14    /// Must return [`TxStoreResponse::Transaction`]
15    Get(TxId),
16    /// Promote a transaction from the stem pool to the public pool.
17    ///
18    /// If the tx is already in the fluff pool do nothing.
19    ///
20    /// This should not error if the tx isn't in the pool at all.
21    Promote(TxId),
22}
23
24#[cfg(feature = "txpool")]
25/// A response sent back from the backing transaction pool.
26pub enum TxStoreResponse<Tx> {
27    /// A generic ok response.
28    Ok,
29    /// A response containing a requested transaction.
30    Transaction(Option<(Tx, crate::State)>),
31}