mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: use primitive transaction as PoolTransaction::Consensus (#13086)
This commit is contained in:
@ -17,6 +17,7 @@ use reth_network_api::{
|
||||
NetworkEvent, NetworkEventListenerProvider, NetworkInfo, Peers,
|
||||
};
|
||||
use reth_network_peers::PeerId;
|
||||
use reth_primitives::TransactionSigned;
|
||||
use reth_provider::{test_utils::NoopProvider, ChainSpecProvider};
|
||||
use reth_storage_api::{BlockReader, BlockReaderIdExt, HeaderProvider, StateProviderFactory};
|
||||
use reth_tasks::TokioTaskExecutor;
|
||||
@ -24,7 +25,7 @@ use reth_tokio_util::EventStream;
|
||||
use reth_transaction_pool::{
|
||||
blobstore::InMemoryBlobStore,
|
||||
test_utils::{TestPool, TestPoolBuilder},
|
||||
EthTransactionPool, TransactionPool, TransactionValidationTaskExecutor,
|
||||
EthTransactionPool, PoolTransaction, TransactionPool, TransactionValidationTaskExecutor,
|
||||
};
|
||||
use secp256k1::SecretKey;
|
||||
use std::{
|
||||
@ -202,7 +203,9 @@ where
|
||||
+ Clone
|
||||
+ Unpin
|
||||
+ 'static,
|
||||
Pool: TransactionPool + Unpin + 'static,
|
||||
Pool: TransactionPool<Transaction: PoolTransaction<Consensus = TransactionSigned>>
|
||||
+ Unpin
|
||||
+ 'static,
|
||||
{
|
||||
/// Spawns the testnet to a separate task
|
||||
pub fn spawn(self) -> TestnetHandle<C, Pool> {
|
||||
@ -267,7 +270,9 @@ where
|
||||
> + HeaderProvider
|
||||
+ Unpin
|
||||
+ 'static,
|
||||
Pool: TransactionPool + Unpin + 'static,
|
||||
Pool: TransactionPool<Transaction: PoolTransaction<Consensus = TransactionSigned>>
|
||||
+ Unpin
|
||||
+ 'static,
|
||||
{
|
||||
type Output = ();
|
||||
|
||||
@ -468,7 +473,9 @@ where
|
||||
> + HeaderProvider
|
||||
+ Unpin
|
||||
+ 'static,
|
||||
Pool: TransactionPool + Unpin + 'static,
|
||||
Pool: TransactionPool<Transaction: PoolTransaction<Consensus = TransactionSigned>>
|
||||
+ Unpin
|
||||
+ 'static,
|
||||
{
|
||||
type Output = ();
|
||||
|
||||
|
||||
@ -702,9 +702,8 @@ where
|
||||
BroadcastedTransaction: SignedTransaction,
|
||||
PooledTransaction: SignedTransaction,
|
||||
>,
|
||||
<<Pool as TransactionPool>::Transaction as PoolTransaction>::Consensus:
|
||||
Into<N::BroadcastedTransaction>,
|
||||
<<Pool as TransactionPool>::Transaction as PoolTransaction>::Pooled: Into<N::PooledTransaction>,
|
||||
Pool::Transaction:
|
||||
PoolTransaction<Consensus = N::BroadcastedTransaction, Pooled: Into<N::PooledTransaction>>,
|
||||
{
|
||||
/// Invoked when transactions in the local mempool are considered __pending__.
|
||||
///
|
||||
@ -1011,9 +1010,8 @@ where
|
||||
impl<Pool> TransactionsManager<Pool>
|
||||
where
|
||||
Pool: TransactionPool + 'static,
|
||||
<<Pool as TransactionPool>::Transaction as PoolTransaction>::Consensus: Into<TransactionSigned>,
|
||||
<<Pool as TransactionPool>::Transaction as PoolTransaction>::Pooled:
|
||||
Into<PooledTransactionsElement>,
|
||||
Pool::Transaction:
|
||||
PoolTransaction<Consensus = TransactionSigned, Pooled: Into<PooledTransactionsElement>>,
|
||||
{
|
||||
/// Handles dedicated transaction events related to the `eth` protocol.
|
||||
fn on_network_tx_event(&mut self, event: NetworkTransactionEvent) {
|
||||
@ -1313,9 +1311,8 @@ where
|
||||
impl<Pool> Future for TransactionsManager<Pool>
|
||||
where
|
||||
Pool: TransactionPool + Unpin + 'static,
|
||||
<<Pool as TransactionPool>::Transaction as PoolTransaction>::Consensus: Into<TransactionSigned>,
|
||||
<<Pool as TransactionPool>::Transaction as PoolTransaction>::Pooled:
|
||||
Into<PooledTransactionsElement>,
|
||||
Pool::Transaction:
|
||||
PoolTransaction<Consensus = TransactionSigned, Pooled: Into<PooledTransactionsElement>>,
|
||||
{
|
||||
type Output = ();
|
||||
|
||||
@ -1503,11 +1500,11 @@ impl<T: SignedTransaction> PropagateTransaction<T> {
|
||||
/// Create a new instance from a pooled transaction
|
||||
fn new<P>(tx: Arc<ValidPoolTransaction<P>>) -> Self
|
||||
where
|
||||
P: PoolTransaction<Consensus: Into<T>>,
|
||||
P: PoolTransaction<Consensus = T>,
|
||||
{
|
||||
let size = tx.encoded_length();
|
||||
let transaction = tx.transaction.clone_into_consensus().into();
|
||||
let transaction = Arc::new(transaction);
|
||||
let transaction = tx.transaction.clone_into_consensus();
|
||||
let transaction = Arc::new(transaction.into_signed());
|
||||
Self { size, transaction }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user