Skip to content

Commit

Permalink
Fix grandpa initialization (paritytech#583)
Browse files Browse the repository at this point in the history
* fix grandpa initialization

* fnt
  • Loading branch information
svyatonik authored and serban300 committed Apr 9, 2024
1 parent 45f2f6e commit 3931a3f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
14 changes: 12 additions & 2 deletions bridges/bin/millau/node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ pub fn new_partial(
}

/// Builds a new service for a full client.
pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {
pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError> {
let sc_service::PartialComponents {
client,
backend,
Expand All @@ -132,6 +132,11 @@ pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {
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,
Expand Down Expand Up @@ -325,10 +330,15 @@ pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {
}

/// Builds a new service for a light client.
pub fn new_light(config: Configuration) -> Result<TaskManager, ServiceError> {
pub fn new_light(mut config: Configuration) -> Result<TaskManager, ServiceError> {
let (client, backend, keystore_container, mut task_manager, on_demand) =
sc_service::new_light_parts::<Block, RuntimeApi, Executor>(&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(
Expand Down
14 changes: 12 additions & 2 deletions bridges/bin/rialto/node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ pub fn new_partial(
}

/// Builds a new service for a full client.
pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {
pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError> {
let sc_service::PartialComponents {
client,
backend,
Expand All @@ -132,6 +132,11 @@ pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {
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,
Expand Down Expand Up @@ -324,10 +329,15 @@ pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {
}

/// Builds a new service for a light client.
pub fn new_light(config: Configuration) -> Result<TaskManager, ServiceError> {
pub fn new_light(mut config: Configuration) -> Result<TaskManager, ServiceError> {
let (client, backend, keystore_container, mut task_manager, on_demand) =
sc_service::new_light_parts::<Block, RuntimeApi, Executor>(&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(
Expand Down

0 comments on commit 3931a3f

Please sign in to comment.