From 765abacf4daae3d41317af3eb9d1f76d826d25be Mon Sep 17 00:00:00 2001 From: Age Manning Date: Tue, 8 Oct 2024 16:41:18 +1100 Subject: [PATCH] Correct match conditions --- src/service.rs | 4 ++-- src/service/test.rs | 13 ++++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/service.rs b/src/service.rs index 32dedbc3..4b852db7 100644 --- a/src/service.rs +++ b/src/service.rs @@ -1356,9 +1356,9 @@ impl Service { if let Some(ip_votes) = self.ip_votes.as_mut() { match (ip_votes.majority(), enr.udp4_socket(), enr.udp6_socket()) { // We don't have enough ipv4 votes, but this is an IPv4 node. - ((None, Some(_)), Some(_), _) | + ((Some(_), None), Some(_), _) | // We don't have enough ipv6 votes, but this is an IPv6 node - ((Some(_), None), _, Some(_)) | + ((None, Some(_)), _, Some(_)) | // We don't have enough ipv6 or ipv4 nodes, ping this peer ((None, None), _, _) => self.send_ping(enr, None), // We have enough votes do nothing diff --git a/src/service/test.rs b/src/service/test.rs index ea1b0244..49de94d0 100644 --- a/src/service/test.rs +++ b/src/service/test.rs @@ -112,7 +112,7 @@ async fn build_service( } } -fn build_non_handler_service( +fn build_non_handler_service( local_enr: Arc>, enr_key: Arc>, filters: bool, @@ -452,12 +452,11 @@ async fn test_ipv6_update_amongst_ipv4_dominated_network() { .build(&enr_key) .unwrap(); - let (mut service, mut handler_recv, _handler_send) = - build_non_handler_service::( - Arc::new(RwLock::new(local_enr)), - Arc::new(RwLock::new(enr_key)), - false, - ); + let (mut service, mut handler_recv, _handler_send) = build_non_handler_service( + Arc::new(RwLock::new(local_enr)), + Arc::new(RwLock::new(enr_key)), + false, + ); // Load up the routing table with 100 random ENRs