chore(txpool): update TransactionPool trait bounds (#376)

This commit is contained in:
Matthias Seitz
2022-12-10 18:16:26 +01:00
committed by GitHub
parent eedd31ca59
commit 9eebd141b7
5 changed files with 12 additions and 9 deletions

View File

@ -107,7 +107,7 @@ pub struct TransactionsManager<Pool> {
impl<Pool> TransactionsManager<Pool> impl<Pool> TransactionsManager<Pool>
where where
Pool: TransactionPool + Clone, Pool: TransactionPool + 'static,
<Pool as TransactionPool>::Transaction: IntoRecoveredTransaction, <Pool as TransactionPool>::Transaction: IntoRecoveredTransaction,
{ {
/// Sets up a new instance. /// Sets up a new instance.
@ -377,7 +377,7 @@ where
/// This should be spawned or used as part of `tokio::select!`. /// This should be spawned or used as part of `tokio::select!`.
impl<Pool> Future for TransactionsManager<Pool> impl<Pool> Future for TransactionsManager<Pool>
where where
Pool: TransactionPool + Clone + Unpin, Pool: TransactionPool + Unpin + 'static,
<Pool as TransactionPool>::Transaction: IntoRecoveredTransaction, <Pool as TransactionPool>::Transaction: IntoRecoveredTransaction,
{ {
type Output = (); type Output = ();

View File

@ -1,7 +1,7 @@
//! Provides everything related to `eth_` namespace //! Provides everything related to `eth_` namespace
use reth_interfaces::Result; use reth_interfaces::Result;
use reth_primitives::{Transaction, U256, U64}; use reth_primitives::{U256, U64};
use reth_provider::{BlockProvider, StateProviderFactory}; use reth_provider::{BlockProvider, StateProviderFactory};
use reth_transaction_pool::TransactionPool; use reth_transaction_pool::TransactionPool;
use std::sync::Arc; use std::sync::Arc;
@ -24,8 +24,8 @@ pub struct EthApi<Pool, Client> {
impl<Pool, Client> EthApi<Pool, Client> impl<Pool, Client> EthApi<Pool, Client>
where where
Pool: TransactionPool<Transaction = Transaction> + Clone, Pool: TransactionPool + 'static,
Client: BlockProvider + StateProviderFactory, Client: BlockProvider + StateProviderFactory + 'static,
{ {
/// Creates a new, shareable instance. /// Creates a new, shareable instance.
pub fn new(client: Arc<Client>, pool: Pool) -> Self { pub fn new(client: Arc<Client>, pool: Pool) -> Self {

View File

@ -5,7 +5,7 @@ use crate::{eth::api::EthApi, result::ToRpcResult};
use jsonrpsee::core::RpcResult as Result; use jsonrpsee::core::RpcResult as Result;
use reth_primitives::{ use reth_primitives::{
rpc::{transaction::eip2930::AccessListWithGasUsed, BlockId}, rpc::{transaction::eip2930::AccessListWithGasUsed, BlockId},
Address, BlockNumber, Bytes, Transaction, H256, H64, U256, U64, Address, BlockNumber, Bytes, H256, H64, U256, U64,
}; };
use reth_provider::{BlockProvider, StateProviderFactory}; use reth_provider::{BlockProvider, StateProviderFactory};
use reth_rpc_api::EthApiServer; use reth_rpc_api::EthApiServer;
@ -19,7 +19,7 @@ use serde_json::Value;
#[async_trait::async_trait] #[async_trait::async_trait]
impl<Pool, Client> EthApiServer for EthApi<Pool, Client> impl<Pool, Client> EthApiServer for EthApi<Pool, Client>
where where
Pool: TransactionPool<Transaction = Transaction> + Clone + 'static, Pool: TransactionPool + 'static,
Client: BlockProvider + StateProviderFactory + 'static, Client: BlockProvider + StateProviderFactory + 'static,
{ {
fn protocol_version(&self) -> Result<U64> { fn protocol_version(&self) -> Result<U64> {

View File

@ -28,7 +28,7 @@ impl<Pool, Client> EthPubSub<Pool, Client> {
impl<Pool, Client> EthPubSubApiServer for EthPubSub<Pool, Client> impl<Pool, Client> EthPubSubApiServer for EthPubSub<Pool, Client>
where where
Pool: TransactionPool + Clone, Pool: TransactionPool + 'static,
Client: BlockProvider + 'static, Client: BlockProvider + 'static,
{ {
fn subscribe( fn subscribe(

View File

@ -9,8 +9,11 @@ use tokio::sync::mpsc::Receiver;
/// This is intended to be used by API-consumers such as RPC that need inject new incoming, /// This is intended to be used by API-consumers such as RPC that need inject new incoming,
/// unverified transactions. And by block production that needs to get transactions to execute in a /// unverified transactions. And by block production that needs to get transactions to execute in a
/// new block. /// new block.
///
/// Note: This requires `Clone` for convenience, since it is assumed that this will be implemented
/// for a wrapped `Arc` type, see also [`Pool`](crate::Pool).
#[async_trait::async_trait] #[async_trait::async_trait]
pub trait TransactionPool: Send + Sync + 'static { pub trait TransactionPool: Send + Sync + Clone {
/// The transaction type of the pool /// The transaction type of the pool
type Transaction: PoolTransaction; type Transaction: PoolTransaction;