Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Remove txpool as an export of sc_transaction_pool, exporting the used components instead. #9217

Merged
2 commits merged into from
Jun 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions client/consensus/manual-seal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use sp_blockchain::HeaderBackend;
use sp_inherents::CreateInherentDataProviders;
use sp_runtime::{traits::Block as BlockT, Justifications, ConsensusEngineId};
use sc_client_api::backend::{Backend as ClientBackend, Finalizer};
use sc_transaction_pool::txpool;
use sc_transaction_pool::{ChainApi, Pool};
use std::{sync::Arc, marker::PhantomData};
use prometheus_endpoint::Registry;

Expand Down Expand Up @@ -94,7 +94,7 @@ pub fn import_queue<Block, Transaction>(
}

/// Params required to start the instant sealing authorship task.
pub struct ManualSealParams<B: BlockT, BI, E, C: ProvideRuntimeApi<B>, A: txpool::ChainApi, SC, CS, CIDP> {
pub struct ManualSealParams<B: BlockT, BI, E, C: ProvideRuntimeApi<B>, A: ChainApi, SC, CS, CIDP> {
/// Block import instance for well. importing blocks.
pub block_import: BI,

Expand All @@ -105,7 +105,7 @@ pub struct ManualSealParams<B: BlockT, BI, E, C: ProvideRuntimeApi<B>, A: txpool
pub client: Arc<C>,

/// Shared reference to the transaction pool.
pub pool: Arc<txpool::Pool<A>>,
pub pool: Arc<Pool<A>>,

/// Stream<Item = EngineCommands>, Basically the receiving end of a channel for sending commands to
/// the authorship task.
Expand All @@ -122,7 +122,7 @@ pub struct ManualSealParams<B: BlockT, BI, E, C: ProvideRuntimeApi<B>, A: txpool
}

/// Params required to start the manual sealing authorship task.
pub struct InstantSealParams<B: BlockT, BI, E, C: ProvideRuntimeApi<B>, A: txpool::ChainApi, SC, CIDP> {
pub struct InstantSealParams<B: BlockT, BI, E, C: ProvideRuntimeApi<B>, A: ChainApi, SC, CIDP> {
/// Block import instance for well. importing blocks.
pub block_import: BI,

Expand All @@ -133,7 +133,7 @@ pub struct InstantSealParams<B: BlockT, BI, E, C: ProvideRuntimeApi<B>, A: txpoo
pub client: Arc<C>,

/// Shared reference to the transaction pool.
pub pool: Arc<txpool::Pool<A>>,
pub pool: Arc<Pool<A>>,

/// SelectChain strategy.
pub select_chain: SC,
Expand All @@ -159,7 +159,7 @@ pub async fn run_manual_seal<B, BI, CB, E, C, A, SC, CS, CIDP>(
}: ManualSealParams<B, BI, E, C, A, SC, CS, CIDP>
)
where
A: txpool::ChainApi<Block=B> + 'static,
A: ChainApi<Block=B> + 'static,
B: BlockT + 'static,
BI: BlockImport<B, Error = sp_consensus::Error, Transaction = sp_api::TransactionFor<C, B>>
+ Send + Sync + 'static,
Expand Down Expand Up @@ -227,7 +227,7 @@ pub async fn run_instant_seal<B, BI, CB, E, C, A, SC, CIDP>(
}: InstantSealParams<B, BI, E, C, A, SC, CIDP>
)
where
A: txpool::ChainApi<Block=B> + 'static,
A: ChainApi<Block=B> + 'static,
B: BlockT + 'static,
BI: BlockImport<B, Error = sp_consensus::Error, Transaction = sp_api::TransactionFor<C, B>>
+ Send + Sync + 'static,
Expand Down Expand Up @@ -275,7 +275,7 @@ mod tests {
AccountKeyring::*,
TestClientBuilder,
};
use sc_transaction_pool::{BasicPool, RevalidationType, txpool::Options};
use sc_transaction_pool::{BasicPool, RevalidationType, Options};
use substrate_test_runtime_transaction_pool::{TestApi, uxt};
use sp_transaction_pool::{TransactionPool, MaintainedTransactionPool, TransactionSource};
use sp_runtime::generic::BlockId;
Expand Down
8 changes: 4 additions & 4 deletions client/consensus/manual-seal/src/seal_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use sp_runtime::{
generic::BlockId,
};
use futures::prelude::*;
use sc_transaction_pool::txpool;
use sc_transaction_pool::{ChainApi, Pool};
use sp_consensus::{
self, BlockImport, Environment, Proposer, ForkChoiceStrategy,
BlockImportParams, BlockOrigin, ImportResult, SelectChain, StateAction,
Expand All @@ -40,7 +40,7 @@ use sp_api::{ProvideRuntimeApi, TransactionFor};
pub const MAX_PROPOSAL_DURATION: u64 = 10;

/// params for sealing a new block
pub struct SealBlockParams<'a, B: BlockT, BI, SC, C: ProvideRuntimeApi<B>, E, P: txpool::ChainApi, CIDP> {
pub struct SealBlockParams<'a, B: BlockT, BI, SC, C: ProvideRuntimeApi<B>, E, P: ChainApi, CIDP> {
/// if true, empty blocks(without extrinsics) will be created.
/// otherwise, will return Error::EmptyTransactionPool.
pub create_empty: bool,
Expand All @@ -51,7 +51,7 @@ pub struct SealBlockParams<'a, B: BlockT, BI, SC, C: ProvideRuntimeApi<B>, E, P:
/// sender to report errors/success to the rpc.
pub sender: rpc::Sender<CreatedBlock<<B as BlockT>::Hash>>,
/// transaction pool
pub pool: Arc<txpool::Pool<P>>,
pub pool: Arc<Pool<P>>,
/// header backend
pub client: Arc<C>,
/// Environment trait object for creating a proposer
Expand Down Expand Up @@ -90,7 +90,7 @@ pub async fn seal_block<B, BI, SC, C, E, P, CIDP>(
C: HeaderBackend<B> + ProvideRuntimeApi<B>,
E: Environment<B>,
E::Proposer: Proposer<B, Transaction = TransactionFor<C, B>>,
P: txpool::ChainApi<Block = B>,
P: ChainApi<Block = B>,
SC: SelectChain<B>,
TransactionFor<C, B>: 'static,
CIDP: CreateInherentDataProviders<B, ()>,
Expand Down
2 changes: 1 addition & 1 deletion client/service/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub use sc_executor::WasmExecutionMethod;
pub use sc_client_api::execution_extensions::{ExecutionStrategies, ExecutionStrategy};

use std::{io, future::Future, path::{PathBuf, Path}, pin::Pin, net::SocketAddr, sync::Arc};
pub use sc_transaction_pool::txpool::Options as TransactionPoolOptions;
pub use sc_transaction_pool::Options as TransactionPoolOptions;
use sc_chain_spec::ChainSpec;
use sp_core::crypto::SecretString;
pub use sc_telemetry::TelemetryEndpoints;
Expand Down
2 changes: 1 addition & 1 deletion client/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pub use sc_chain_spec::{
NoExtension, ChainType,
};
pub use sp_transaction_pool::{TransactionPool, InPoolTransaction, error::IntoPoolError};
pub use sc_transaction_pool::txpool::Options as TransactionPoolOptions;
pub use sc_transaction_pool::Options as TransactionPoolOptions;
pub use sc_rpc::Metadata as RpcMetadata;
pub use sc_executor::NativeExecutionDispatch;
#[doc(hidden)]
Expand Down
8 changes: 4 additions & 4 deletions client/transaction-pool/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub mod error;
#[cfg(test)]
pub mod testing;

pub use sc_transaction_graph as txpool;
pub use sc_transaction_graph::{ChainApi, Options, Pool};
pub use crate::api::{FullChainApi, LightChainApi};

use std::{collections::{HashMap, HashSet}, sync::Arc, pin::Pin, convert::TryInto};
Expand All @@ -48,7 +48,7 @@ use sp_transaction_pool::{
TransactionStatusStreamFor, MaintainedTransactionPool, PoolFuture, ChainEvent,
TransactionSource,
};
use sc_transaction_graph::{ChainApi, ExtrinsicHash};
use sc_transaction_graph::{IsValidator, ExtrinsicHash};
use wasm_timer::Instant;

use prometheus_endpoint::Registry as PrometheusRegistry;
Expand Down Expand Up @@ -191,7 +191,7 @@ impl<PoolApi, Block> BasicPool<PoolApi, Block>
/// revalidation type.
pub fn with_revalidation_type(
options: sc_transaction_graph::Options,
is_validator: txpool::IsValidator,
is_validator: IsValidator,
pool_api: Arc<PoolApi>,
prometheus: Option<&PrometheusRegistry>,
revalidation_type: RevalidationType,
Expand Down Expand Up @@ -397,7 +397,7 @@ where
/// Create new basic transaction pool for a full node with the provided api.
pub fn new_full(
options: sc_transaction_graph::Options,
is_validator: txpool::IsValidator,
is_validator: IsValidator,
prometheus: Option<&PrometheusRegistry>,
spawner: impl SpawnEssentialNamed,
client: Arc<Client>,
Expand Down
1 change: 0 additions & 1 deletion client/transaction-pool/src/testing/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
use crate::*;
use sp_transaction_pool::TransactionStatus;
use futures::executor::{block_on, block_on_stream};
use txpool::{self, Pool};
use sp_runtime::{
generic::BlockId,
transaction_validity::{ValidTransaction, TransactionSource, InvalidTransaction},
Expand Down