pub struct PackingBatch<TX: PackingPoolTransaction> { /* private fields */ }
Expand description

A batch of transactions that have the same sender and continuous nonces.

PackingBatch is designed to group transactions from the same sender that can be packed into the same block. This struct ensures that all transactions in the batch have the same sender and their nonces form a continuous sequence.

Implementations§

source§

impl<TX: PackingPoolTransaction> PackingBatch<TX>

source

pub fn new(tx: TX) -> Self

source

pub fn sender(&self) -> TX::Sender

source

pub fn start_nonce(&self) -> U256

source

pub fn first_gas_price(&self) -> U256

source

pub fn total_gas_limit(&self) -> U256

source

pub fn len(&self) -> usize

source

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

Inserts a transaction into the pool according to PackingPoolConfig, without violating the assumptions of PackingBatch.

§Returns

Returns a tuple consisting of:

  • A vector of transactions that were replaced by the insertion. This can be empty if no transactions were displaced.
  • A result indicating the success or failure of the insertion operation.
source

pub fn split_off_suffix(&mut self, index: usize) -> Result<Vec<TX>, RemoveError>

Removes transactions starting from the specified index (included) and returns them.

source

pub fn split_off_prefix(&mut self, index: usize) -> Result<Vec<TX>, RemoveError>

Removes transactions ending at the specified index (not included) and returns them.

source

pub fn split_off_by_nonce( &mut self, nonce: &U256, keep_prefix: bool ) -> Result<Vec<TX>, RemoveError>

Split transactions at the specified nonce (the specified one is in the past half). Retains a half according to keep_prefix and returns the rest half.

Trait Implementations§

source§

impl<TX: Clone + PackingPoolTransaction> Clone for PackingBatch<TX>

source§

fn clone(&self) -> PackingBatch<TX>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<TX: Debug + PackingPoolTransaction> Debug for PackingBatch<TX>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<TX: Default + PackingPoolTransaction> Default for PackingBatch<TX>

source§

fn default() -> PackingBatch<TX>

Returns the “default value” for a type. Read more
source§

impl<TX> MallocSizeOf for PackingBatch<TX>
where TX: MallocSizeOf + PackingPoolTransaction,

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.
source§

impl<TX: PartialEq + PackingPoolTransaction> PartialEq for PackingBatch<TX>

source§

fn eq(&self, other: &PackingBatch<TX>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<TX: Eq + PackingPoolTransaction> Eq for PackingBatch<TX>

source§

impl<TX: PackingPoolTransaction> StructuralPartialEq for PackingBatch<TX>

Auto Trait Implementations§

§

impl<TX> RefUnwindSafe for PackingBatch<TX>
where TX: RefUnwindSafe,

§

impl<TX> Send for PackingBatch<TX>
where TX: Send,

§

impl<TX> Sync for PackingBatch<TX>
where TX: Sync,

§

impl<TX> Unpin for PackingBatch<TX>
where TX: Unpin,

§

impl<TX> UnwindSafe for PackingBatch<TX>
where TX: UnwindSafe,

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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