Fix Network trait implementation not doing what it's supposed to do (#7985)

This commit is contained in:
Pierre Krieger
2021-01-26 15:05:56 +01:00
committed by GitHub
parent 054b0f542e
commit 6ae24c91e9
+2 -2
View File
@@ -113,7 +113,7 @@ impl<B: BlockT, H: ExHashT> Network<B> for Arc<NetworkService<B, H>> {
fn add_set_reserved(&self, who: PeerId, protocol: Cow<'static, str>) {
let addr = iter::once(multiaddr::Protocol::P2p(who.into()))
.collect::<multiaddr::Multiaddr>();
let result = NetworkService::add_to_peers_set(self, protocol, iter::once(addr).collect());
let result = NetworkService::add_peers_to_reserved_set(self, protocol, iter::once(addr).collect());
if let Err(err) = result {
log::error!(target: "gossip", "add_set_reserved failed: {}", err);
}
@@ -122,7 +122,7 @@ impl<B: BlockT, H: ExHashT> Network<B> for Arc<NetworkService<B, H>> {
fn remove_set_reserved(&self, who: PeerId, protocol: Cow<'static, str>) {
let addr = iter::once(multiaddr::Protocol::P2p(who.into()))
.collect::<multiaddr::Multiaddr>();
let result = NetworkService::remove_from_peers_set(self, protocol, iter::once(addr).collect());
let result = NetworkService::remove_peers_from_reserved_set(self, protocol, iter::once(addr).collect());
if let Err(err) = result {
log::error!(target: "gossip", "remove_set_reserved failed: {}", err);
}