mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-01-28 16:48:13 -05:00
chore(txpool): add IntoRecoveredTransaction to PoolTransaction (#1750)
This commit is contained in:
@@ -250,7 +250,9 @@ impl<T> BestTransactions for std::iter::Empty<T> {
|
||||
}
|
||||
|
||||
/// Trait for transaction types used inside the pool
|
||||
pub trait PoolTransaction: fmt::Debug + Send + Sync + FromRecoveredTransaction {
|
||||
pub trait PoolTransaction:
|
||||
fmt::Debug + Send + Sync + FromRecoveredTransaction + IntoRecoveredTransaction
|
||||
{
|
||||
/// Hash of the transaction.
|
||||
fn hash(&self) -> &TxHash;
|
||||
|
||||
|
||||
@@ -7,8 +7,9 @@ use crate::{
|
||||
MAX_INIT_CODE_SIZE, TX_MAX_SIZE,
|
||||
};
|
||||
use reth_primitives::{
|
||||
Address, InvalidTransactionError, TransactionKind, TxHash, EIP1559_TX_TYPE_ID,
|
||||
EIP2930_TX_TYPE_ID, LEGACY_TX_TYPE_ID, U256,
|
||||
Address, IntoRecoveredTransaction, InvalidTransactionError, TransactionKind,
|
||||
TransactionSignedEcRecovered, TxHash, EIP1559_TX_TYPE_ID, EIP2930_TX_TYPE_ID,
|
||||
LEGACY_TX_TYPE_ID, U256,
|
||||
};
|
||||
use reth_provider::AccountProvider;
|
||||
use std::{fmt, time::Instant};
|
||||
@@ -330,6 +331,12 @@ impl<T: PoolTransaction> ValidPoolTransaction<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: PoolTransaction> IntoRecoveredTransaction for ValidPoolTransaction<T> {
|
||||
fn to_recovered_transaction(&self) -> TransactionSignedEcRecovered {
|
||||
self.transaction.to_recovered_transaction()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
impl<T: PoolTransaction + Clone> Clone for ValidPoolTransaction<T> {
|
||||
fn clone(&self) -> Self {
|
||||
|
||||
Reference in New Issue
Block a user