Unverified Commit 6b4225f5 authored by Bastian Köcher's avatar Bastian Köcher Committed by GitHub
Browse files

Remove `collating_for` argument from service (#1802)

The collator is now enabled in a different way and we don't require this
argument anymore.
parent 0dc1fcdf
Pipeline #110083 passed with stages
in 22 minutes and 46 seconds
......@@ -148,7 +148,6 @@ pub fn run() -> Result<()> {
Role::Light => service::build_light(config).map(|(task_manager, _)| task_manager),
_ => service::build_full(
config,
None,
authority_discovery_enabled,
grandpa_pause,
).map(|full| full.task_manager),
......@@ -189,7 +188,7 @@ pub fn run() -> Result<()> {
network_status_sinks,
..
} = service::build_full(
config, None, authority_discovery_enabled, grandpa_pause,
config, authority_discovery_enabled, grandpa_pause,
)?;
let client = Arc::new(client);
......
......@@ -328,7 +328,6 @@ impl<C> NewFull<C> {
#[cfg(feature = "full-node")]
pub fn new_full<RuntimeApi, Executor>(
mut config: Configuration,
collating_for: Option<(CollatorId, ParaId)>,
authority_discovery_enabled: bool,
grandpa_pause: Option<(u32, u32)>,
) -> Result<NewFull<Arc<FullClient<RuntimeApi, Executor>>>, Error>
......@@ -338,9 +337,7 @@ pub fn new_full<RuntimeApi, Executor>(
RuntimeApiCollection<StateBackend = sc_client_api::StateBackendFor<FullBackend, Block>>,
Executor: NativeExecutionDispatch + 'static,
{
let is_collator = collating_for.is_some();
let role = config.role.clone();
let is_authority = role.is_authority() && !is_collator;
let force_authoring = config.force_authoring;
let disable_grandpa = config.disable_grandpa;
let name = config.network.node_name.clone();
......@@ -470,7 +467,7 @@ pub fn new_full<RuntimeApi, Executor>(
// if the node isn't actively participating in consensus then it doesn't
// need a keystore, regardless of which protocol we use below.
let keystore_opt = if is_authority {
let keystore_opt = if role.is_authority() {
Some(keystore_container.sync_keystore())
} else {
None
......@@ -746,35 +743,30 @@ pub fn build_light(config: Configuration) -> Result<(TaskManager, RpcHandlers),
#[cfg(feature = "full-node")]
pub fn build_full(
config: Configuration,
collating_for: Option<(CollatorId, ParaId)>,
authority_discovery_enabled: bool,
grandpa_pause: Option<(u32, u32)>,
) -> Result<NewFull<Client>, ServiceError> {
if config.chain_spec.is_rococo() {
new_full::<rococo_runtime::RuntimeApi, RococoExecutor>(
config,
collating_for,
authority_discovery_enabled,
grandpa_pause,
).map(|full| full.with_client(Client::Rococo))
} else if config.chain_spec.is_kusama() {
new_full::<kusama_runtime::RuntimeApi, KusamaExecutor>(
config,
collating_for,
authority_discovery_enabled,
grandpa_pause,
).map(|full| full.with_client(Client::Kusama))
} else if config.chain_spec.is_westend() {
new_full::<westend_runtime::RuntimeApi, WestendExecutor>(
config,
collating_for,
authority_discovery_enabled,
grandpa_pause,
).map(|full| full.with_client(Client::Westend))
} else {
new_full::<polkadot_runtime::RuntimeApi, PolkadotExecutor>(
config,
collating_for,
authority_discovery_enabled,
grandpa_pause,
).map(|full| full.with_client(Client::Polkadot))
......
......@@ -23,9 +23,7 @@ mod chain_spec;
pub use chain_spec::*;
use futures::future::Future;
use polkadot_overseer::OverseerHandler;
use polkadot_primitives::v0::{
Block, CollatorId, Id as ParaId,
};
use polkadot_primitives::v1::Block;
use polkadot_runtime_common::BlockHashCount;
use polkadot_service::{
new_full, NewFull, FullClient, AbstractClient, ClientHandle, ExecuteWithClient,
......@@ -63,7 +61,6 @@ native_executor_instance!(
/// Create a new Polkadot test service for a full node.
pub fn polkadot_test_new_full(
config: Configuration,
collating_for: Option<(CollatorId, ParaId)>,
authority_discovery_enabled: bool,
) -> Result<
NewFull<Arc<FullClient<polkadot_test_runtime::RuntimeApi, PolkadotTestExecutor>>>,
......@@ -71,7 +68,6 @@ pub fn polkadot_test_new_full(
> {
new_full::<polkadot_test_runtime::RuntimeApi, PolkadotTestExecutor>(
config,
collating_for,
authority_discovery_enabled,
None,
).map_err(Into::into)
......@@ -198,7 +194,7 @@ pub fn run_test_node(
let multiaddr = config.network.listen_addresses[0].clone();
let authority_discovery_enabled = false;
let NewFull {task_manager, client, network, rpc_handlers, node_handles, ..} =
polkadot_test_new_full(config, None, authority_discovery_enabled)
polkadot_test_new_full(config, authority_discovery_enabled)
.expect("could not create Polkadot test service");
let peer_id = network.local_peer_id().clone();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment