Skip to content

Commit

Permalink
feat: added as_any implementation to FullClientTransactionPool
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksandar Brayanov committed Dec 2, 2024
1 parent 08a6dc9 commit f3d164a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
32 changes: 18 additions & 14 deletions substrate/client/transaction-pool/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,19 +110,19 @@ impl TransactionPoolOptions {
/// This trait defines the requirements for a full client transaction pool, ensuring
/// that it can handle transactions submission and maintenance.
pub trait FullClientTransactionPool<Block, Client>:
MaintainedTransactionPool<
Block = Block,
Hash = ExtrinsicHash<FullChainApi<Client, Block>>,
InPoolTransaction = Transaction<
ExtrinsicHash<FullChainApi<Client, Block>>,
ExtrinsicFor<FullChainApi<Client, Block>>,
>,
Error = <FullChainApi<Client, Block> as ChainApi>::Error,
> + LocalTransactionPool<
Block = Block,
Hash = ExtrinsicHash<FullChainApi<Client, Block>>,
Error = <FullChainApi<Client, Block> as ChainApi>::Error,
>
MaintainedTransactionPool<
Block = Block,
Hash = ExtrinsicHash<FullChainApi<Client, Block>>,
InPoolTransaction=Transaction<
ExtrinsicHash<FullChainApi<Client, Block>>,
ExtrinsicFor<FullChainApi<Client, Block>>,
>,
Error = <FullChainApi<Client, Block> as ChainApi>::Error,
> + LocalTransactionPool<
Block = Block,
Hash = ExtrinsicHash<FullChainApi<Client, Block>>,
Error = <FullChainApi<Client, Block> as ChainApi>::Error,
> + std::any::Any
where
Block: BlockT,
Client: sp_api::ProvideRuntimeApi<Block>
Expand All @@ -133,6 +133,7 @@ where
+ 'static,
Client::Api: sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>,
{
fn as_any(&self) -> &dyn std::any::Any;
}

impl<Block, Client, P> FullClientTransactionPool<Block, Client> for P
Expand All @@ -157,8 +158,11 @@ where
Block = Block,
Hash = ExtrinsicHash<FullChainApi<Client, Block>>,
Error = <FullChainApi<Client, Block> as ChainApi>::Error,
>,
>+ 'static,
{
fn as_any(&self) -> &dyn std::any::Any {
self as &dyn std::any::Any
}
}

/// The public type alias for the actual type providing the implementation of
Expand Down
2 changes: 1 addition & 1 deletion substrate/client/transaction-pool/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use common::{api, enactment_state};
use std::{future::Future, pin::Pin, sync::Arc};

pub use api::FullChainApi;
pub use builder::{Builder, TransactionPoolHandle, TransactionPoolOptions, TransactionPoolType};
pub use builder::{Builder, TransactionPoolHandle, TransactionPoolOptions, TransactionPoolType, FullClientTransactionPool};
pub use common::notification_future;
pub use fork_aware_txpool::{ForkAwareTxPool, ForkAwareTxPoolTask};
pub use graph::{base_pool::Limit as PoolLimit, ChainApi, Options, Pool};
Expand Down

0 comments on commit f3d164a

Please sign in to comment.