pub type MockValidTx = ValidPoolTransaction<MockTransaction>;
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>
impl<T: PoolTransaction> ValidPoolTransaction<T>
Sourcepub fn sender_ref(&self) -> &Address
pub fn sender_ref(&self) -> &Address
Returns a reference to the address of the sender
Sourcepub fn to(&self) -> Option<Address>
pub fn to(&self) -> Option<Address>
Returns the recipient of the transaction if it is not a CREATE transaction.
Sourcepub fn encoded_length(&self) -> usize
pub fn encoded_length(&self) -> usize
Returns the length of the rlp encoded transaction
Sourcepub fn cost(&self) -> &U256
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
.
Sourcepub fn max_fee_per_blob_gas(&self) -> Option<u128>
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.
Sourcepub fn max_fee_per_gas(&self) -> u128
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
.
Sourcepub fn effective_tip_per_gas(&self, base_fee: u64) -> Option<u128>
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
.
Sourcepub fn priority_fee_or_price(&self) -> u128
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.
Sourcepub fn gas_limit(&self) -> u64
pub fn gas_limit(&self) -> u64
Maximum amount of gas that the transaction is allowed to consume.
Sourcepub fn is_eip4844(&self) -> bool
pub fn is_eip4844(&self) -> bool
Whether the transaction is an EIP-4844 blob transaction.
Sourcepub fn to_consensus(&self) -> Recovered<T::Consensus>
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>
.