pub struct Mempool { /* private fields */ }Expand description
Mempool data structure: transaction IDs plus outpoints spent by those transactions.
Implementations§
Source§impl Mempool
impl Mempool
pub fn new() -> Mempool
Sourcepub fn insert(&mut self, txid: [u8; 32]) -> bool
pub fn insert(&mut self, txid: [u8; 32]) -> bool
Insert a transaction ID only (does not register spent outpoints).
Prefer insert_transaction when the full transaction is
available — conflict detection requires outpoint indexing.
Sourcepub fn insert_transaction(&mut self, tx: &Transaction) -> bool
pub fn insert_transaction(&mut self, tx: &Transaction) -> bool
Register a transaction and index its spent inputs for conflict detection.
pub fn contains(&self, txid: &[u8; 32]) -> bool
pub fn spends_outpoint(&self, outpoint: &OutPoint) -> bool
pub fn remove(&mut self, txid: &[u8; 32]) -> bool
Sourcepub fn remove_spending_any(
&mut self,
outpoints: &HashSet<OutPoint>,
) -> Vec<[u8; 32]>
pub fn remove_spending_any( &mut self, outpoints: &HashSet<OutPoint>, ) -> Vec<[u8; 32]>
Remove mempool entries that spend any of the given outpoints (e.g. after block connect).
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn iter(&self) -> impl Iterator<Item = &[u8; 32]>
pub fn clear(&mut self)
Sourcepub fn total_vbytes(&self) -> usize
pub fn total_vbytes(&self) -> usize
Total virtual size of transactions indexed via insert_transaction.
Trait Implementations§
impl Eq for Mempool
impl StructuralPartialEq for 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 UnsafeUnpin 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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