Struct cfx_packing_pool::PackingPool
source · pub struct PackingPool<TX: PackingPoolTransaction> { /* private fields */ }
Expand description
A PackingPool
implementing random packing algorithm and supporting packing
a series of transactions with the same nonce.
Implementations§
source§impl<TX: PackingPoolTransaction> PackingPool<TX>
impl<TX: PackingPoolTransaction> PackingPool<TX>
pub fn new(config: PackingPoolConfig) -> Self
pub fn config(&self) -> &PackingPoolConfig
pub fn len(&self) -> usize
pub fn iter(&self) -> impl Iterator<Item = &[TX]> + '_
pub fn contains(&self, addr: &TX::Sender) -> bool
pub fn get_transactions(&self, addr: &TX::Sender) -> Option<&[TX]>
pub fn clear(&mut self)
pub fn insert(&mut self, tx: TX) -> (Vec<TX>, Result<(), InsertError>)
pub fn replace(&mut self, packing_batch: PackingBatch<TX>) -> Vec<TX>
pub fn remove(&mut self, sender: TX::Sender) -> Vec<TX>
pub fn split_off_suffix( &mut self, sender: TX::Sender, start_nonce: &U256 ) -> Vec<TX>
pub fn split_off_prefix( &mut self, sender: TX::Sender, start_nonce: &U256 ) -> Vec<TX>
pub fn tx_sampler<'a, 'b, R: RngCore>(
&'a self,
rng: &'b mut R,
block_gas_limit: U256
) -> impl Iterator<Item = (TX::Sender, &'a [TX], SampleTag)> + 'bwhere
'a: 'b,
sourcepub fn truncate_loss_ratio(&self, block_gas_limit: U256) -> Option<U256>
pub fn truncate_loss_ratio(&self, block_gas_limit: U256) -> Option<U256>
The maximum loss ratio that a gas_price is considered in random packing
algorithm. If the return value is None
, all the transactions can
not fulfill the given block_gas_limit
.
pub fn estimate_packing_gas_limit( &self, gas_target: U256, parent_base_price: U256, min_base_price: U256 ) -> U256
Trait Implementations§
source§impl<TX> MallocSizeOf for PackingPool<TX>where
TX: PackingPoolTransaction + MallocSizeOf,
TX::Sender: MallocSizeOf,
impl<TX> MallocSizeOf for PackingPool<TX>where
TX: PackingPoolTransaction + MallocSizeOf,
TX::Sender: MallocSizeOf,
Auto Trait Implementations§
impl<TX> RefUnwindSafe for PackingPool<TX>
impl<TX> Send for PackingPool<TX>
impl<TX> Sync for PackingPool<TX>
impl<TX> Unpin for PackingPool<TX>
impl<TX> UnwindSafe for PackingPool<TX>
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