From efe2267ec7c4b05aece5e0d59ad51978906745d5 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Sun, 9 May 2021 21:37:41 +0200 Subject: [PATCH] Two bugfixes to authority-discovery (#8768) --- .../client/authority-discovery/src/worker/addr_cache.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/substrate/client/authority-discovery/src/worker/addr_cache.rs b/substrate/client/authority-discovery/src/worker/addr_cache.rs index 7cefff1aaf..c9b0711803 100644 --- a/substrate/client/authority-discovery/src/worker/addr_cache.rs +++ b/substrate/client/authority-discovery/src/worker/addr_cache.rs @@ -42,10 +42,6 @@ impl AddrCache { /// Inserts the given [`AuthorityId`] and [`Vec`] pair for future lookups by /// [`AuthorityId`] or [`PeerId`]. pub fn insert(&mut self, authority_id: AuthorityId, mut addresses: Vec) { - if addresses.is_empty() { - return; - } - addresses.sort_unstable_by(|a, b| a.as_ref().cmp(b.as_ref())); // Insert into `self.peer_id_to_authority_id`. @@ -80,8 +76,7 @@ impl AddrCache { }; if !peer_ids.clone().any(|p| p == peer_id) { - let _old_auth = self.peer_id_to_authority_id.remove(&peer_id); - debug_assert!(_old_auth.is_some()); + self.peer_id_to_authority_id.remove(&peer_id); } } }