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>

source

pub fn new(config: PackingPoolConfig) -> Self

source

pub fn config(&self) -> &PackingPoolConfig

source

pub fn len(&self) -> usize

source

pub fn iter(&self) -> impl Iterator<Item = &[TX]> + '_

source

pub fn contains(&self, addr: &TX::Sender) -> bool

source

pub fn get_transactions(&self, addr: &TX::Sender) -> Option<&[TX]>

source

pub fn clear(&mut self)

source

pub fn insert(&mut self, tx: TX) -> (Vec<TX>, Result<(), InsertError>)

source

pub fn replace(&mut self, packing_batch: PackingBatch<TX>) -> Vec<TX>

source

pub fn remove(&mut self, sender: TX::Sender) -> Vec<TX>

source

pub fn split_off_suffix( &mut self, sender: TX::Sender, start_nonce: &U256 ) -> Vec<TX>

source

pub fn split_off_prefix( &mut self, sender: TX::Sender, start_nonce: &U256 ) -> Vec<TX>

source

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)> + 'b
where 'a: 'b,

source

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.

source

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,

source§

fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize

Measure the heap usage of all descendant heap-allocated structures, but not the space taken up by the value itself.

Auto Trait Implementations§

§

impl<TX> RefUnwindSafe for PackingPool<TX>

§

impl<TX> Send for PackingPool<TX>
where TX: Send, <TX as PackingPoolTransaction>::Sender: Send,

§

impl<TX> Sync for PackingPool<TX>
where TX: Sync, <TX as PackingPoolTransaction>::Sender: Sync,

§

impl<TX> Unpin for PackingPool<TX>

§

impl<TX> UnwindSafe for PackingPool<TX>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V