diff --git a/node/src/endpoint_gossip/mod.rs b/node/src/endpoint_gossip/mod.rs index 5a684e2f100527116ddc61e721327fa560cd77f6..94e41121be060458f84120941f7e1b65e167b50c 100644 --- a/node/src/endpoint_gossip/mod.rs +++ b/node/src/endpoint_gossip/mod.rs @@ -56,7 +56,7 @@ pub fn set_config( // copied from grandpa config // /substrate/client/consensus/grandpa/src/lib.rs:212 -struct EndpointGossipConfig { +pub struct EndpointGossipConfig { /// The expected duration for a message to be gossiped across the network. gossip_duration: std::time::Duration, /// Period (in blocks) to share endpoints again @@ -67,14 +67,14 @@ struct EndpointGossipConfig { protocol_name: ProtocolName, } -struct EndpointGossipParams<Network> { +pub struct EndpointGossipParams<Network> { config: EndpointGossipConfig, network: Network, notification_service: Box<dyn NotificationService>, offchain_endpoint_tester: (), } -fn run_gossip_worker<Network>(params: EndpointGossipParams<Network>) { +pub fn run_gossip_worker<Network>(params: EndpointGossipParams<Network>) { let topic = "XXX"; // TODO network has no gossip engine, it is created in network bridge diff --git a/node/src/service.rs b/node/src/service.rs index 131c41aa59642eb9336e75190aeabe3923dece81..0d5e85df79f6a09cd5c4a7cd8c3bab40b39e3d68 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -150,28 +150,31 @@ pub fn new_partial<RuntimeApi, Executor>( consensus_manual: bool, duniter_config: crate::cli::DuniterConfigExtension, ) -> Result< - sc_service::PartialComponents< - FullClient<RuntimeApi, Executor>, - FullBackend, - FullSelectChain, - sc_consensus::DefaultImportQueue<Block>, - sc_transaction_pool::FullPool<Block, FullClient<RuntimeApi, Executor>>, - ( - sc_consensus_babe::BabeBlockImport< - Block, - FullClient<RuntimeApi, Executor>, - FullGrandpaBlockImport<RuntimeApi, Executor>, - >, - sc_consensus_babe::BabeLink<Block>, - Option<sc_consensus_babe::BabeWorkerHandle<Block>>, - sc_consensus_grandpa::LinkHalf< - Block, - FullClient<RuntimeApi, Executor>, - FullSelectChain, - >, - Option<Telemetry>, - ), - >, + ( + sc_service::PartialComponents< + FullClient<RuntimeApi, Executor>, + FullBackend, + FullSelectChain, + sc_consensus::DefaultImportQueue<Block>, + sc_transaction_pool::FullPool<Block, FullClient<RuntimeApi, Executor>>, + ( + sc_consensus_babe::BabeBlockImport< + Block, + FullClient<RuntimeApi, Executor>, + FullGrandpaBlockImport<RuntimeApi, Executor>, + >, + sc_consensus_babe::BabeLink<Block>, + Option<sc_consensus_babe::BabeWorkerHandle<Block>>, + sc_consensus_grandpa::LinkHalf< + Block, + FullClient<RuntimeApi, Executor>, + FullSelectChain, + >, + Option<Telemetry>, + ), + >, + crate::cli::DuniterConfigExtension, + ), ServiceError, > where @@ -279,22 +282,25 @@ where (queue, Some(handle)) }; - Ok(sc_service::PartialComponents { - client, - backend, - task_manager, - import_queue, - keystore_container, - select_chain, - transaction_pool, - other: ( - babe_block_import, - babe_link, - babe_worker_handle, - grandpa_link, - telemetry, - ), - }) + Ok(( + sc_service::PartialComponents { + client, + backend, + task_manager, + import_queue, + keystore_container, + select_chain, + transaction_pool, + other: ( + babe_block_import, + babe_link, + babe_worker_handle, + grandpa_link, + telemetry, + ), + }, + duniter_config, + )) } /// Builds a new service for a full client. @@ -316,16 +322,19 @@ where Executor: sc_executor::NativeExecutionDispatch + 'static, Executor: sc_executor::sp_wasm_interface::HostFunctions + 'static, { - let sc_service::PartialComponents { - client, - backend, - mut task_manager, - import_queue, - keystore_container, - select_chain, - transaction_pool, - other: (block_import, babe_link, babe_worker_handle, grandpa_link, mut telemetry), - } = new_partial::<RuntimeApi, Executor>( + let ( + sc_service::PartialComponents { + client, + backend, + mut task_manager, + import_queue, + keystore_container, + select_chain, + transaction_pool, + other: (block_import, babe_link, babe_worker_handle, grandpa_link, mut telemetry), + }, + duniter_options, + ) = new_partial::<RuntimeApi, Executor>( &config, sealing.is_manual_consensus(), duniter_options, @@ -714,7 +723,7 @@ where task_manager.spawn_handle().spawn( "endpoint-gossip", None, - crate::endpoint_gossip::run_gossip_worker(endpoint_gossip_params)?, + crate::endpoint_gossip::run_gossip_worker(endpoint_gossip_params), ); // }