pub struct OrphanPool { /* private fields */ }Expand description
The orphan transaction pool.
Implementations§
Source§impl OrphanPool
impl OrphanPool
Sourcepub fn with_config(max_orphans: usize, expire_time: u64) -> Self
pub fn with_config(max_orphans: usize, expire_time: u64) -> Self
Create with custom limits (useful for testing).
Sourcepub fn add_orphan(
&mut self,
tx: Transaction,
from_peer: u64,
now: u64,
) -> AddOrphanResult
pub fn add_orphan( &mut self, tx: Transaction, from_peer: u64, now: u64, ) -> AddOrphanResult
Add a transaction to the orphan pool.
Returns the result of the add operation.
Sourcepub fn remove_orphan(&mut self, txid: &Txid) -> Option<OrphanEntry>
pub fn remove_orphan(&mut self, txid: &Txid) -> Option<OrphanEntry>
Remove an orphan by txid. Returns the entry if it was present.
Sourcepub fn get_orphans_by_prev(&self, outpoint: &OutPoint) -> Vec<Txid>
pub fn get_orphans_by_prev(&self, outpoint: &OutPoint) -> Vec<Txid>
Get all orphan txids that depend on a given outpoint.
Call this when a new transaction is accepted to find orphans that can now be re-evaluated.
Sourcepub fn get_children_of(
&self,
parent_txid: &Txid,
output_count: u32,
) -> Vec<Txid>
pub fn get_children_of( &self, parent_txid: &Txid, output_count: u32, ) -> Vec<Txid>
Get all orphan txids that depend on any output of a given transaction.
This is the common pattern: when tx parent_txid is accepted, find
all orphans that spent one of its outputs.
Sourcepub fn expire_old_orphans(&mut self, now: u64) -> usize
pub fn expire_old_orphans(&mut self, now: u64) -> usize
Remove all orphans that are older than the expiry time.
Returns the number of orphans removed.
Sourcepub fn remove_for_peer(&mut self, peer_id: u64) -> usize
pub fn remove_for_peer(&mut self, peer_id: u64) -> usize
Remove all orphans from a specific peer.
Useful when a peer is banned or disconnected.
Sourcepub fn get(&self, txid: &Txid) -> Option<&OrphanEntry>
pub fn get(&self, txid: &Txid) -> Option<&OrphanEntry>
Get an orphan entry by txid.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for OrphanPool
impl RefUnwindSafe for OrphanPool
impl Send for OrphanPool
impl Sync for OrphanPool
impl Unpin for OrphanPool
impl UnsafeUnpin for OrphanPool
impl UnwindSafe for OrphanPool
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