Type Alias MockValidTx

Source
pub type MockValidTx = ValidPoolTransaction<MockTransaction>;
Available on crate feature test-utils only.
Expand description

A validated transaction in the transaction pool, using MockTransaction as the transaction type.

This type is an alias for ValidPoolTransaction<MockTransaction>.

Aliased Type§

struct MockValidTx {
    pub transaction: MockTransaction,
    pub transaction_id: TransactionId,
    pub propagate: bool,
    pub timestamp: Instant,
    pub origin: TransactionOrigin,
}

Fields§

§transaction: MockTransaction

The transaction

§transaction_id: TransactionId

The identifier for this transaction.

§propagate: bool

Whether it is allowed to propagate the transaction.

§timestamp: Instant

Timestamp when this was added to the pool.

§origin: TransactionOrigin

Where this transaction originated from.

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 416 bytes

Implementations

Source§

impl<T: PoolTransaction> ValidPoolTransaction<T>

Source

pub fn hash(&self) -> &TxHash

Returns the hash of the transaction.

Source

pub fn tx_type(&self) -> u8

Returns the type identifier of the transaction

Source

pub fn sender(&self) -> Address

Returns the address of the sender

Source

pub fn sender_ref(&self) -> &Address

Returns a reference to the address of the sender

Source

pub fn to(&self) -> Option<Address>

Returns the recipient of the transaction if it is not a CREATE transaction.

Source

pub fn encoded_length(&self) -> usize

Returns the length of the rlp encoded transaction

Source

pub fn nonce(&self) -> u64

Returns the nonce set for this transaction.

Source

pub fn cost(&self) -> &U256

Returns the cost that this transaction is allowed to consume:

For EIP-1559 transactions: max_fee_per_gas * gas_limit + tx_value. For legacy transactions: gas_price * gas_limit + tx_value.

Source

pub fn max_fee_per_blob_gas(&self) -> Option<u128>

Returns the EIP-4844 max blob fee the caller is willing to pay.

For non-EIP-4844 transactions, this returns None.

Source

pub fn max_fee_per_gas(&self) -> u128

Returns the EIP-1559 Max base fee the caller is willing to pay.

For legacy transactions this is gas_price.

Source

pub fn effective_tip_per_gas(&self, base_fee: u64) -> Option<u128>

Returns the effective tip for this transaction.

For EIP-1559 transactions: min(max_fee_per_gas - base_fee, max_priority_fee_per_gas). For legacy transactions: gas_price - base_fee.

Source

pub fn priority_fee_or_price(&self) -> u128

Returns the max priority fee per gas if the transaction is an EIP-1559 transaction, and otherwise returns the gas price.

Source

pub fn gas_limit(&self) -> u64

Maximum amount of gas that the transaction is allowed to consume.

Source

pub const fn is_local(&self) -> bool

Whether the transaction originated locally.

Source

pub fn is_eip4844(&self) -> bool

Whether the transaction is an EIP-4844 blob transaction.

Source

pub fn to_consensus(&self) -> Recovered<T::Consensus>

Converts to this type into the consensus transaction of the pooled transaction.

Note: this takes &self since indented usage is via Arc<Self>.

Trait Implementations

Source§

impl<T: PoolTransaction> Debug for ValidPoolTransaction<T>

Source§

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

Formats the value using the given formatter. Read more