소스 검색

hosts: reject peers from other hosts that already exist on our greylist

Previously we would update the last seen field, however it is better to
let the refinery do that and keep the insertion process strictly
seperate.
draoi 2 년 전
부모
커밋
4d0c36a508
1개의 변경된 파일3개의 추가작업 그리고 4개의 파일을 삭제
  1. 3 4
      src/net/hosts.rs

+ 3 - 4
src/net/hosts.rs

@@ -1145,13 +1145,12 @@ impl Hosts {
                 continue
             }
 
-            // Reject this peer if it's already stored on the Gold or White list.
-            // If it exists on the Grey list, we will simply update its last_seen
-            // field.
+            // Reject this peer if it's already stored on the Gold, White or Grey list.
             //
             // We do this last since it is the most expensive operation.
             if self.container.contains(HostColor::Gold as usize, addr_).await ||
-                self.container.contains(HostColor::White as usize, addr_).await
+                self.container.contains(HostColor::White as usize, addr_).await ||
+                    self.container.contains(HostColor::Grey as usize, addr_).await
             {
                 debug!(target: "net::hosts::filter_addresses()",
                     "We already have {} in the hostlist. Skipping", addr_);