mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 19:17:58 +00:00
Add a build-sync-spec subcommand and remove the CHT roots from the light sync state. (#6999)
* Move subcommands from sc-cli to nodes * Add --build-sync-spec subcommand * Remove CHTs from snapshots * Keep ProvideChtRoots
This commit is contained in:
@@ -151,6 +151,15 @@ pub fn new_partial(config: &Configuration) -> Result<sc_service::PartialComponen
|
||||
})
|
||||
}
|
||||
|
||||
pub struct NewFullBase {
|
||||
pub task_manager: TaskManager,
|
||||
pub inherent_data_providers: InherentDataProviders,
|
||||
pub client: Arc<FullClient>,
|
||||
pub network: Arc<NetworkService<Block, <Block as BlockT>::Hash>>,
|
||||
pub network_status_sinks: sc_service::NetworkStatusSinks<Block>,
|
||||
pub transaction_pool: Arc<sc_transaction_pool::FullPool<Block, FullClient>>,
|
||||
}
|
||||
|
||||
/// Creates a full service from the configuration.
|
||||
pub fn new_full_base(
|
||||
config: Configuration,
|
||||
@@ -158,11 +167,7 @@ pub fn new_full_base(
|
||||
&sc_consensus_babe::BabeBlockImport<Block, FullClient, FullGrandpaBlockImport>,
|
||||
&sc_consensus_babe::BabeLink<Block>,
|
||||
)
|
||||
) -> Result<(
|
||||
TaskManager, InherentDataProviders, Arc<FullClient>,
|
||||
Arc<NetworkService<Block, <Block as BlockT>::Hash>>,
|
||||
Arc<sc_transaction_pool::FullPool<Block, FullClient>>,
|
||||
), ServiceError> {
|
||||
) -> Result<NewFullBase, ServiceError> {
|
||||
let sc_service::PartialComponents {
|
||||
client, backend, mut task_manager, import_queue, keystore, select_chain, transaction_pool,
|
||||
inherent_data_providers,
|
||||
@@ -210,7 +215,7 @@ pub fn new_full_base(
|
||||
on_demand: None,
|
||||
remote_blockchain: None,
|
||||
telemetry_connection_sinks: telemetry_connection_sinks.clone(),
|
||||
network_status_sinks,
|
||||
network_status_sinks: network_status_sinks.clone(),
|
||||
system_rpc_tx,
|
||||
})?;
|
||||
|
||||
@@ -330,13 +335,16 @@ pub fn new_full_base(
|
||||
}
|
||||
|
||||
network_starter.start_network();
|
||||
Ok((task_manager, inherent_data_providers, client, network, transaction_pool))
|
||||
Ok(NewFullBase {
|
||||
task_manager, inherent_data_providers, client, network, network_status_sinks,
|
||||
transaction_pool,
|
||||
})
|
||||
}
|
||||
|
||||
/// Builds a new service for a full client.
|
||||
pub fn new_full(config: Configuration)
|
||||
-> Result<TaskManager, ServiceError> {
|
||||
new_full_base(config, |_, _| ()).map(|(task_manager, _, _, _, _)| {
|
||||
new_full_base(config, |_, _| ()).map(|NewFullBase { task_manager, .. }| {
|
||||
task_manager
|
||||
})
|
||||
}
|
||||
@@ -467,7 +475,7 @@ mod tests {
|
||||
use sp_finality_tracker;
|
||||
use sp_keyring::AccountKeyring;
|
||||
use sc_service_test::TestNetNode;
|
||||
use crate::service::{new_full_base, new_light_base};
|
||||
use crate::service::{new_full_base, new_light_base, NewFullBase};
|
||||
use sp_runtime::traits::IdentifyAccount;
|
||||
use sp_transaction_pool::{MaintainedTransactionPool, ChainEvent};
|
||||
use sc_client_api::BlockBackend;
|
||||
@@ -499,18 +507,19 @@ mod tests {
|
||||
chain_spec,
|
||||
|config| {
|
||||
let mut setup_handles = None;
|
||||
let (keep_alive, inherent_data_providers, client, network, transaction_pool) =
|
||||
new_full_base(config,
|
||||
|
|
||||
block_import: &sc_consensus_babe::BabeBlockImport<Block, _, _>,
|
||||
babe_link: &sc_consensus_babe::BabeLink<Block>,
|
||||
| {
|
||||
setup_handles = Some((block_import.clone(), babe_link.clone()));
|
||||
}
|
||||
)?;
|
||||
let NewFullBase {
|
||||
task_manager, inherent_data_providers, client, network, transaction_pool, ..
|
||||
} = new_full_base(config,
|
||||
|
|
||||
block_import: &sc_consensus_babe::BabeBlockImport<Block, _, _>,
|
||||
babe_link: &sc_consensus_babe::BabeLink<Block>,
|
||||
| {
|
||||
setup_handles = Some((block_import.clone(), babe_link.clone()));
|
||||
}
|
||||
)?;
|
||||
|
||||
let node = sc_service_test::TestNetComponents::new(
|
||||
keep_alive, client, network, transaction_pool
|
||||
task_manager, client, network, transaction_pool
|
||||
);
|
||||
Ok((node, (inherent_data_providers, setup_handles.unwrap())))
|
||||
},
|
||||
@@ -661,8 +670,9 @@ mod tests {
|
||||
sc_service_test::consensus(
|
||||
crate::chain_spec::tests::integration_test_config_with_two_authorities(),
|
||||
|config| {
|
||||
let (keep_alive, _, client, network, transaction_pool) = new_full_base(config, |_, _| ())?;
|
||||
Ok(sc_service_test::TestNetComponents::new(keep_alive, client, network, transaction_pool))
|
||||
let NewFullBase { task_manager, client, network, transaction_pool, .. }
|
||||
= new_full_base(config,|_, _| ())?;
|
||||
Ok(sc_service_test::TestNetComponents::new(task_manager, client, network, transaction_pool))
|
||||
},
|
||||
|config| {
|
||||
let (keep_alive, _, client, network, transaction_pool) = new_light_base(config)?;
|
||||
|
||||
Reference in New Issue
Block a user