reth_transaction_pool/pool/update.rs
1//! Support types for updating the pool.
2
3use crate::{identifier::TransactionId, pool::state::SubPool};
4use alloy_primitives::TxHash;
5
6/// A change of the transaction's location
7///
8/// NOTE: this guarantees that `current` and `destination` differ.
9#[derive(Debug)]
10pub(crate) struct PoolUpdate {
11 /// Internal tx id.
12 pub(crate) id: TransactionId,
13 /// Hash of the transaction.
14 pub(crate) hash: TxHash,
15 /// Where the transaction is currently held.
16 pub(crate) current: SubPool,
17 /// Where to move the transaction to.
18 pub(crate) destination: Destination,
19}
20
21/// Where to move an existing transaction.
22#[derive(Debug)]
23pub(crate) enum Destination {
24 /// Discard the transaction.
25 Discard,
26 /// Move transaction to pool
27 Pool(SubPool),
28}
29
30impl From<SubPool> for Destination {
31 fn from(sub_pool: SubPool) -> Self {
32 Self::Pool(sub_pool)
33 }
34}