mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: add missing helper functions and docs (#3646)
This commit is contained in:
@ -48,24 +48,43 @@ impl TxState {
|
||||
}
|
||||
}
|
||||
|
||||
/// Identifier for the used Sub-pool
|
||||
/// Identifier for the transaction Sub-pool
|
||||
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
|
||||
#[repr(u8)]
|
||||
pub enum SubPool {
|
||||
/// The queued sub-pool contains transactions that are not ready to be included in the next
|
||||
/// block because they have missing or queued ancestors.
|
||||
Queued = 0,
|
||||
/// The pending sub-pool contains transactions that are ready to be included in the next block.
|
||||
Pending,
|
||||
/// The base-fee sub-pool contains transactions that are not ready to be included in the next
|
||||
/// block because they don't meet the base fee requirement.
|
||||
BaseFee,
|
||||
}
|
||||
|
||||
// === impl PoolDestination ===
|
||||
// === impl SubPool ===
|
||||
|
||||
impl SubPool {
|
||||
/// Whether this transaction is to be moved to the pending sub-pool.
|
||||
#[inline]
|
||||
pub fn is_pending(&self) -> bool {
|
||||
matches!(self, SubPool::Pending)
|
||||
}
|
||||
|
||||
/// Whether this transaction is in the queued pool.
|
||||
#[inline]
|
||||
pub fn is_queued(&self) -> bool {
|
||||
matches!(self, SubPool::Queued)
|
||||
}
|
||||
|
||||
/// Whether this transaction is in the base fee pool.
|
||||
#[inline]
|
||||
pub fn is_base_fee(&self) -> bool {
|
||||
matches!(self, SubPool::BaseFee)
|
||||
}
|
||||
|
||||
/// Returns whether this is a promotion depending on the current sub-pool location.
|
||||
#[inline]
|
||||
pub fn is_promoted(&self, other: SubPool) -> bool {
|
||||
self > &other
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user