diff --git a/substrate/bin/node-template/node/src/service.rs b/substrate/bin/node-template/node/src/service.rs index f87aaf5ec2..fe1b3af4eb 100644 --- a/substrate/bin/node-template/node/src/service.rs +++ b/substrate/bin/node-template/node/src/service.rs @@ -154,7 +154,6 @@ pub fn new_full(config: Configuration) link: grandpa_link, network: service.network(), inherent_data_providers: inherent_data_providers.clone(), - on_exit: service.on_exit(), telemetry_on_connect: Some(service.telemetry_on_connect_stream()), voting_rule: grandpa::VotingRulesBuilder::default().build(), prometheus_registry: service.prometheus_registry() diff --git a/substrate/bin/node/cli/src/service.rs b/substrate/bin/node/cli/src/service.rs index f31fa0b973..ca7bd43161 100644 --- a/substrate/bin/node/cli/src/service.rs +++ b/substrate/bin/node/cli/src/service.rs @@ -225,7 +225,6 @@ macro_rules! new_full { link: grandpa_link, network: service.network(), inherent_data_providers: inherent_data_providers.clone(), - on_exit: service.on_exit(), telemetry_on_connect: Some(service.telemetry_on_connect_stream()), voting_rule: grandpa::VotingRulesBuilder::default().build(), prometheus_registry: service.prometheus_registry(), diff --git a/substrate/client/finality-grandpa/src/lib.rs b/substrate/client/finality-grandpa/src/lib.rs index e9ea244a72..38c1070d77 100644 --- a/substrate/client/finality-grandpa/src/lib.rs +++ b/substrate/client/finality-grandpa/src/lib.rs @@ -536,7 +536,7 @@ fn register_finality_tracker_inherent_data_provider( } /// Parameters used to run Grandpa. -pub struct GrandpaParams { +pub struct GrandpaParams { /// Configuration for the GRANDPA service. pub config: Config, /// A link to the block import worker. @@ -545,8 +545,6 @@ pub struct GrandpaParams { pub network: N, /// The inherent data providers. pub inherent_data_providers: InherentDataProviders, - /// Handle to a future that will resolve on exit. - pub on_exit: X, /// If supplied, can be used to hook on telemetry connection established events. pub telemetry_on_connect: Option>, /// A voting rule used to potentially restrict target votes. @@ -557,8 +555,8 @@ pub struct GrandpaParams { /// Run a GRANDPA voter as a task. Provide configuration and a link to a /// block import worker that has already been instantiated with `block_import`. -pub fn run_grandpa_voter( - grandpa_params: GrandpaParams, +pub fn run_grandpa_voter( + grandpa_params: GrandpaParams, ) -> sp_blockchain::Result + Unpin + Send + 'static> where Block::Hash: Ord, BE: Backend + 'static, @@ -567,7 +565,6 @@ pub fn run_grandpa_voter( VR: VotingRule + Clone + 'static, NumberFor: BlockNumberOps, DigestFor: Encode, - X: futures::Future + Clone + Send + Unpin + 'static, C: ClientForGrandpa + 'static, { let GrandpaParams { @@ -575,7 +572,6 @@ pub fn run_grandpa_voter( link, network, inherent_data_providers, - on_exit, telemetry_on_connect, voting_rule, prometheus_registry, @@ -647,7 +643,7 @@ pub fn run_grandpa_voter( let telemetry_task = telemetry_task .then(|_| future::pending::<()>()); - Ok(future::select(future::select(voter_work, on_exit), telemetry_task).map(drop)) + Ok(future::select(voter_work, telemetry_task).map(drop)) } /// Future that powers the voter. diff --git a/substrate/client/finality-grandpa/src/observer.rs b/substrate/client/finality-grandpa/src/observer.rs index f6cf1a8aa1..97352b68e3 100644 --- a/substrate/client/finality-grandpa/src/observer.rs +++ b/substrate/client/finality-grandpa/src/observer.rs @@ -159,8 +159,8 @@ pub fn run_grandpa_observer( config: Config, link: LinkHalf, network: N, - on_exit: impl futures::Future + Clone + Send + Unpin + 'static, -) -> sp_blockchain::Result + Unpin + Send + 'static> where +) -> sp_blockchain::Result + Unpin + Send + 'static> +where BE: Backend + Unpin + 'static, N: NetworkT + Send + Clone + 'static, SC: SelectChain + 'static, @@ -194,7 +194,7 @@ pub fn run_grandpa_observer( warn!("GRANDPA Observer failed: {:?}", e); }); - Ok(future::select(observer_work, on_exit).map(drop)) + Ok(observer_work.map(drop)) } /// Future that powers the observer. diff --git a/substrate/client/finality-grandpa/src/tests.rs b/substrate/client/finality-grandpa/src/tests.rs index 2734101500..aedcb20a59 100644 --- a/substrate/client/finality-grandpa/src/tests.rs +++ b/substrate/client/finality-grandpa/src/tests.rs @@ -190,17 +190,6 @@ impl TestNetFactory for GrandpaTestNet { } } -#[derive(Clone)] -struct Exit; - -impl futures::Future for Exit { - type Output = (); - - fn poll(self: Pin<&mut Self>, _: &mut task::Context) -> task::Poll<()> { - task::Poll::Pending - } -} - #[derive(Default, Clone)] pub(crate) struct TestApi { genesis_authorities: AuthorityList, @@ -444,7 +433,6 @@ fn run_to_completion_with( link: link, network: net_service, inherent_data_providers: InherentDataProviders::new(), - on_exit: Exit, telemetry_on_connect: None, voting_rule: (), prometheus_registry: None, @@ -576,7 +564,6 @@ fn finalize_3_voters_1_full_observer() { link: link, network: net_service, inherent_data_providers: InherentDataProviders::new(), - on_exit: Exit, telemetry_on_connect: None, voting_rule: (), prometheus_registry: None, @@ -740,7 +727,6 @@ fn transition_3_voters_twice_1_full_observer() { link: link, network: net_service, inherent_data_providers: InherentDataProviders::new(), - on_exit: Exit, telemetry_on_connect: None, voting_rule: (), prometheus_registry: None, @@ -1166,7 +1152,6 @@ fn voter_persists_its_votes() { link, network: this.net.lock().peers[0].network_service().clone(), inherent_data_providers: InherentDataProviders::new(), - on_exit: Exit, telemetry_on_connect: None, voting_rule: VotingRulesBuilder::default().build(), prometheus_registry: None, @@ -1382,7 +1367,6 @@ fn finalize_3_voters_1_light_observer() { }, link, net.lock().peers[3].network_service().clone(), - Exit, ).unwrap() ); @@ -1512,7 +1496,6 @@ fn voter_catches_up_to_latest_round_when_behind() { link, network: net.lock().peer(peer_id).network_service().clone(), inherent_data_providers: InherentDataProviders::new(), - on_exit: Exit, telemetry_on_connect: None, voting_rule: (), prometheus_registry: None,