Type Alias MockValidTx
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: 400 bytes
Implementations
§impl<T> ValidPoolTransaction<T>where
T: PoolTransaction,
impl<T> ValidPoolTransaction<T>where
T: PoolTransaction,
pub fn hash(&self) -> &FixedBytes<32>
pub fn hash(&self) -> &FixedBytes<32>
Returns the hash of the transaction.
pub fn sender_ref(&self) -> &Address
pub fn sender_ref(&self) -> &Address
Returns a reference to the address of the sender
pub fn to(&self) -> Option<Address>
pub fn to(&self) -> Option<Address>
Returns the recipient of the transaction if it is not a CREATE transaction.
pub fn encoded_length(&self) -> usize
pub fn encoded_length(&self) -> usize
Returns the length of the rlp encoded transaction
pub fn cost(&self) -> &Uint<256, 4>
pub fn cost(&self) -> &Uint<256, 4>
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
.
pub 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.
pub 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
.
pub 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
.
pub 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.
pub fn is_eip4844(&self) -> bool
pub fn is_eip4844(&self) -> bool
Whether the transaction is an EIP-4844 blob transaction.
pub fn to_consensus(&self) -> Recovered<<T as PoolTransaction>::Consensus>
pub fn to_consensus(&self) -> Recovered<<T as PoolTransaction>::Consensus>
Converts to this type into the consensus transaction of the pooled transaction.
Note: this takes &self
since indented usage is via Arc<Self>
.