diff --git a/substrate/client/network/src/service.rs b/substrate/client/network/src/service.rs index 03b71b8c86..9bcde11e4b 100644 --- a/substrate/client/network/src/service.rs +++ b/substrate/client/network/src/service.rs @@ -1549,7 +1549,9 @@ impl Future for NetworkWorker { } { let mut peers_notifications_sinks = this.peers_notifications_sinks.lock(); - peers_notifications_sinks.insert((remote.clone(), protocol.clone()), notifications_sink); + let _previous_value = peers_notifications_sinks + .insert((remote.clone(), protocol.clone()), notifications_sink); + debug_assert!(_previous_value.is_none()); } this.event_streams.send(Event::NotificationStreamOpened { remote, @@ -1569,6 +1571,7 @@ impl Future for NetworkWorker { target: "sub-libp2p", "NotificationStreamReplaced for non-existing substream" ); + debug_assert!(false); } // TODO: Notifications might have been lost as a result of the previous @@ -1603,7 +1606,9 @@ impl Future for NetworkWorker { }); { let mut peers_notifications_sinks = this.peers_notifications_sinks.lock(); - peers_notifications_sinks.remove(&(remote.clone(), protocol)); + let _previous_value = peers_notifications_sinks + .remove(&(remote.clone(), protocol)); + debug_assert!(_previous_value.is_some()); } }, Poll::Ready(SwarmEvent::Behaviour(BehaviourOut::NotificationsReceived { remote, messages })) => {