mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-22 13:51:05 +00:00
sc-transcation-pool refactor (#9228)
* Use TransactionPool trait * sc-transaction-pool-primitives * sc-transaction-pool-api * TP * bye sc_transaction_graph * fix line widths * fix import errors * fix import errors * fix import errors 🤦🏾♂️ * fix import errors 🤦🏾♂️🤦🏾♂️🤦🏾♂️ * remove sp-keyring
This commit is contained in:
@@ -66,6 +66,7 @@ codec = { package = "parity-scale-codec", version = "2.0.0" }
|
||||
sc-executor = { version = "0.9.0", path = "../executor" }
|
||||
sc-transaction-pool = { version = "3.0.0", path = "../transaction-pool" }
|
||||
sp-transaction-pool = { version = "3.0.0", path = "../../primitives/transaction-pool" }
|
||||
sc-transaction-pool-api = { version = "3.0.0", path = "../transaction-pool/api" }
|
||||
sp-transaction-storage-proof = { version = "3.0.0", path = "../../primitives/transaction-storage-proof" }
|
||||
sc-rpc-server = { version = "3.0.0", path = "../rpc-servers" }
|
||||
sc-rpc = { version = "3.0.0", path = "../rpc" }
|
||||
|
||||
@@ -60,7 +60,7 @@ use sc_telemetry::{
|
||||
TelemetryHandle,
|
||||
SUBSTRATE_INFO,
|
||||
};
|
||||
use sp_transaction_pool::MaintainedTransactionPool;
|
||||
use sc_transaction_pool_api::MaintainedTransactionPool;
|
||||
use prometheus_endpoint::Registry;
|
||||
use sc_client_db::{Backend, DatabaseSettings};
|
||||
use sp_core::traits::{
|
||||
|
||||
@@ -64,7 +64,7 @@ pub use sc_chain_spec::{
|
||||
ChainSpec, GenericChainSpec, Properties, RuntimeGenesis, Extension as ChainSpecExtension,
|
||||
NoExtension, ChainType,
|
||||
};
|
||||
pub use sp_transaction_pool::{TransactionPool, InPoolTransaction, error::IntoPoolError};
|
||||
pub use sc_transaction_pool_api::{TransactionPool, InPoolTransaction, error::IntoPoolError};
|
||||
pub use sc_transaction_pool::Options as TransactionPoolOptions;
|
||||
pub use sc_rpc::Metadata as RpcMetadata;
|
||||
pub use sc_executor::NativeExecutionDispatch;
|
||||
@@ -456,7 +456,7 @@ where
|
||||
Pool: TransactionPool<Block=B, Hash=H, Error=E>,
|
||||
B: BlockT,
|
||||
H: std::hash::Hash + Eq + sp_runtime::traits::Member + sp_runtime::traits::MaybeSerialize,
|
||||
E: IntoPoolError + From<sp_transaction_pool::error::Error>,
|
||||
E: IntoPoolError + From<sc_transaction_pool_api::error::Error>,
|
||||
{
|
||||
pool.ready()
|
||||
.filter(|t| t.is_propagable())
|
||||
@@ -475,7 +475,7 @@ where
|
||||
Pool: 'static + TransactionPool<Block=B, Hash=H, Error=E>,
|
||||
B: BlockT,
|
||||
H: std::hash::Hash + Eq + sp_runtime::traits::Member + sp_runtime::traits::MaybeSerialize,
|
||||
E: 'static + IntoPoolError + From<sp_transaction_pool::error::Error>,
|
||||
E: 'static + IntoPoolError + From<sc_transaction_pool_api::error::Error>,
|
||||
{
|
||||
fn transactions(&self) -> Vec<(H, B::Extrinsic)> {
|
||||
transactions_to_propagate(&*self.pool)
|
||||
@@ -505,12 +505,12 @@ where
|
||||
|
||||
let best_block_id = BlockId::hash(self.client.info().best_hash);
|
||||
|
||||
let import_future = self.pool.submit_one(&best_block_id, sp_transaction_pool::TransactionSource::External, uxt);
|
||||
let import_future = self.pool.submit_one(&best_block_id, sc_transaction_pool_api::TransactionSource::External, uxt);
|
||||
Box::pin(async move {
|
||||
match import_future.await {
|
||||
Ok(_) => TransactionImport::NewGood,
|
||||
Err(e) => match e.into_pool_error() {
|
||||
Ok(sp_transaction_pool::error::Error::AlreadyImported(_)) => TransactionImport::KnownGood,
|
||||
Ok(sc_transaction_pool_api::error::Error::AlreadyImported(_)) => TransactionImport::KnownGood,
|
||||
Ok(e) => {
|
||||
debug!("Error adding transaction to the pool: {:?}", e);
|
||||
TransactionImport::Bad
|
||||
|
||||
@@ -24,7 +24,7 @@ use prometheus_endpoint::{register, Gauge, U64, Registry, PrometheusError, Opts,
|
||||
use sc_telemetry::{telemetry, TelemetryHandle, SUBSTRATE_INFO};
|
||||
use sp_api::ProvideRuntimeApi;
|
||||
use sp_runtime::traits::{NumberFor, Block, SaturatedConversion, UniqueSaturatedInto};
|
||||
use sp_transaction_pool::{PoolStatus, MaintainedTransactionPool};
|
||||
use sc_transaction_pool_api::{PoolStatus, MaintainedTransactionPool};
|
||||
use sp_utils::metrics::register_globals;
|
||||
use sc_client_api::{ClientInfo, UsageProvider};
|
||||
use sc_network::{config::Role, NetworkStatus, NetworkService};
|
||||
|
||||
@@ -33,7 +33,7 @@ sc-network = { version = "0.9.0", path = "../../network" }
|
||||
sp-consensus = { version = "0.9.0", path = "../../../primitives/consensus/common" }
|
||||
sp-runtime = { version = "3.0.0", path = "../../../primitives/runtime" }
|
||||
sp-core = { version = "3.0.0", path = "../../../primitives/core" }
|
||||
sp-transaction-pool = { version = "3.0.0", path = "../../../primitives/transaction-pool" }
|
||||
sc-transaction-pool-api = { version = "3.0.0", path = "../../../client/transaction-pool/api" }
|
||||
substrate-test-runtime = { version = "2.0.0", path = "../../../test-utils/runtime" }
|
||||
substrate-test-runtime-client = { version = "2.0.0", path = "../../../test-utils/runtime/client" }
|
||||
sc-client-api = { version = "3.0.0", path = "../../api" }
|
||||
|
||||
@@ -47,7 +47,7 @@ use sp_blockchain::HeaderBackend;
|
||||
use sc_network::{multiaddr, Multiaddr};
|
||||
use sc_network::config::{NetworkConfiguration, TransportConfig};
|
||||
use sp_runtime::{generic::BlockId, traits::Block as BlockT};
|
||||
use sp_transaction_pool::TransactionPool;
|
||||
use sc_transaction_pool_api::TransactionPool;
|
||||
use sc_client_api::{Backend, CallExecutor};
|
||||
use parking_lot::Mutex;
|
||||
|
||||
@@ -575,7 +575,7 @@ pub fn sync<G, E, Fb, F, Lb, L, B, ExF, U>(
|
||||
let first_user_data = &network.full_nodes[0].2;
|
||||
let best_block = BlockId::number(first_service.client().info().best_number);
|
||||
let extrinsic = extrinsic_factory(&first_service, first_user_data);
|
||||
let source = sp_transaction_pool::TransactionSource::External;
|
||||
let source = sc_transaction_pool_api::TransactionSource::External;
|
||||
|
||||
futures::executor::block_on(
|
||||
first_service.transaction_pool().submit_one(&best_block, source, extrinsic)
|
||||
|
||||
Reference in New Issue
Block a user