pub struct Mempool { /* private fields */ }Expand description
The transaction mempool.
Implementations§
Source§impl Mempool
impl Mempool
Sourcepub fn new(config: MempoolConfig) -> Self
pub fn new(config: MempoolConfig) -> Self
Creates a new mempool with the given configuration.
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
Creates a new mempool with default configuration.
Sourcepub fn add(&self, transaction: Transaction) -> Result<TransactionId>
pub fn add(&self, transaction: Transaction) -> Result<TransactionId>
Adds a transaction to the mempool.
Sourcepub fn get(&self, id: &TransactionId) -> Option<Transaction>
pub fn get(&self, id: &TransactionId) -> Option<Transaction>
Gets a transaction by ID.
Sourcepub fn contains(&self, id: &TransactionId) -> bool
pub fn contains(&self, id: &TransactionId) -> bool
Checks if a transaction exists in the mempool.
Sourcepub fn remove(&self, id: &TransactionId) -> Option<Transaction>
pub fn remove(&self, id: &TransactionId) -> Option<Transaction>
Removes a transaction from the mempool.
Sourcepub fn remove_batch(&self, ids: &[TransactionId])
pub fn remove_batch(&self, ids: &[TransactionId])
Removes multiple transactions from the mempool.
Sourcepub fn get_for_proposal(&self) -> Vec<Transaction>
pub fn get_for_proposal(&self) -> Vec<Transaction>
Gets transactions for a block proposal.
Returns up to max_transactions_per_block transactions in FIFO order.
Sourcepub fn reap_expired(&self) -> usize
pub fn reap_expired(&self) -> usize
Reaps expired transactions from the mempool.
Sourcepub fn stats(&self) -> MempoolStats
pub fn stats(&self) -> MempoolStats
Returns statistics about the mempool.
Auto Trait Implementations§
impl !Freeze for Mempool
impl !RefUnwindSafe for Mempool
impl Send for Mempool
impl Sync for Mempool
impl Unpin for Mempool
impl UnwindSafe for Mempool
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more