From c6e23b615fce3f77ef0da237166de74b43447559 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Fri, 22 May 2020 12:43:55 +0200 Subject: [PATCH] Add a note about the deprecation of register_notifications_protocol (#6111) --- substrate/client/network/src/service.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/substrate/client/network/src/service.rs b/substrate/client/network/src/service.rs index 4a52bfebdd..d9de0d05c4 100644 --- a/substrate/client/network/src/service.rs +++ b/substrate/client/network/src/service.rs @@ -559,13 +559,17 @@ impl NetworkService { /// Registers a new notifications protocol. /// - /// After that, you can call `write_notifications`. + /// After a protocol has been registered, you can call `write_notifications`. + /// + /// **Important**: This method is a work-around, and you are instead strongly encouraged to + /// pass the protocol in the `NetworkConfiguration::notifications_protocols` list instead. + /// If you have no other choice but to use this method, you are very strongly encouraged to + /// call it very early on. Any connection open will retain the protocols that were registered + /// then, and not any new one. /// /// Please call `event_stream` before registering a protocol, otherwise you may miss events /// about the protocol that you have registered. - /// - /// You are very strongly encouraged to call this method very early on. Any connection open - /// will retain the protocols that were registered then, and not any new one. + // TODO: remove this method after https://github.com/paritytech/substrate/issues/4587 pub fn register_notifications_protocol( &self, engine_id: ConsensusEngineId,