From 6eeedb3d1d9121dcdffa9fd84987bbb75568c9c9 Mon Sep 17 00:00:00 2001 From: Svyatoslav Nikolsky Date: Thu, 17 Dec 2020 22:48:21 +0300 Subject: [PATCH] Fix grandpa initialization (#583) * fix grandpa initialization * fnt --- bridges/bin/millau/node/src/service.rs | 14 ++++++++++++-- bridges/bin/rialto/node/src/service.rs | 14 ++++++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/bridges/bin/millau/node/src/service.rs b/bridges/bin/millau/node/src/service.rs index a9d866af73a37..9cbd2b06a9b45 100644 --- a/bridges/bin/millau/node/src/service.rs +++ b/bridges/bin/millau/node/src/service.rs @@ -119,7 +119,7 @@ pub fn new_partial( } /// Builds a new service for a full client. -pub fn new_full(config: Configuration) -> Result { +pub fn new_full(mut config: Configuration) -> Result { let sc_service::PartialComponents { client, backend, @@ -132,6 +132,11 @@ pub fn new_full(config: Configuration) -> Result { other: (block_import, grandpa_link), } = new_partial(&config)?; + config + .network + .notifications_protocols + .push(sc_finality_grandpa::GRANDPA_PROTOCOL_NAME.into()); + let (network, network_status_sinks, system_rpc_tx, network_starter) = sc_service::build_network(sc_service::BuildNetworkParams { config: &config, @@ -325,10 +330,15 @@ pub fn new_full(config: Configuration) -> Result { } /// Builds a new service for a light client. -pub fn new_light(config: Configuration) -> Result { +pub fn new_light(mut config: Configuration) -> Result { let (client, backend, keystore_container, mut task_manager, on_demand) = sc_service::new_light_parts::(&config)?; + config + .network + .notifications_protocols + .push(sc_finality_grandpa::GRANDPA_PROTOCOL_NAME.into()); + let select_chain = sc_consensus::LongestChain::new(backend.clone()); let transaction_pool = Arc::new(sc_transaction_pool::BasicPool::new_light( diff --git a/bridges/bin/rialto/node/src/service.rs b/bridges/bin/rialto/node/src/service.rs index 57415b73447f6..c235a8e757f8d 100644 --- a/bridges/bin/rialto/node/src/service.rs +++ b/bridges/bin/rialto/node/src/service.rs @@ -119,7 +119,7 @@ pub fn new_partial( } /// Builds a new service for a full client. -pub fn new_full(config: Configuration) -> Result { +pub fn new_full(mut config: Configuration) -> Result { let sc_service::PartialComponents { client, backend, @@ -132,6 +132,11 @@ pub fn new_full(config: Configuration) -> Result { other: (block_import, grandpa_link), } = new_partial(&config)?; + config + .network + .notifications_protocols + .push(sc_finality_grandpa::GRANDPA_PROTOCOL_NAME.into()); + let (network, network_status_sinks, system_rpc_tx, network_starter) = sc_service::build_network(sc_service::BuildNetworkParams { config: &config, @@ -324,10 +329,15 @@ pub fn new_full(config: Configuration) -> Result { } /// Builds a new service for a light client. -pub fn new_light(config: Configuration) -> Result { +pub fn new_light(mut config: Configuration) -> Result { let (client, backend, keystore_container, mut task_manager, on_demand) = sc_service::new_light_parts::(&config)?; + config + .network + .notifications_protocols + .push(sc_finality_grandpa::GRANDPA_PROTOCOL_NAME.into()); + let select_chain = sc_consensus::LongestChain::new(backend.clone()); let transaction_pool = Arc::new(sc_transaction_pool::BasicPool::new_light(