Skip to content

Commit

Permalink
Correct match conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
AgeManning committed Oct 8, 2024
1 parent 493bb12 commit 765abac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 6 additions & 7 deletions src/service/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ async fn build_service<P: ProtocolIdentity>(
}
}

fn build_non_handler_service<P: ProtocolIdentity>(
fn build_non_handler_service(
local_enr: Arc<RwLock<Enr>>,
enr_key: Arc<RwLock<CombinedKey>>,
filters: bool,
Expand Down Expand Up @@ -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::<DefaultProtocolId>(
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

Expand Down

0 comments on commit 765abac

Please sign in to comment.