removes LegacyContactInfo::is_valid_tvu_address (#29570)

Since
https://github.com/solana-labs/solana/pull/20480
turbine includes all epoch staked nodes in tree construction and no
longer relies on obtaining their contact-info from gossip; and so
distinguishing between is_valid_address and is_valid_tvu_address is no
longer necessary and the latter can be removed.
This commit is contained in:
behzad nouri 2023-01-08 22:53:45 +00:00 committed by GitHub
parent 8c212f59ad
commit 677b6d6458
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 10 deletions

View File

@ -1307,7 +1307,7 @@ impl ClusterInfo {
.filter(|node| {
node.id != self_pubkey
&& node.shred_version == self_shred_version
&& ContactInfo::is_valid_tvu_address(&node.tvu)
&& ContactInfo::is_valid_address(&node.tvu, &self.socket_addr_space)
})
.cloned()
.collect()
@ -1324,7 +1324,7 @@ impl ClusterInfo {
.filter(|node| {
node.id != self_pubkey
&& node.shred_version == self_shred_version
&& ContactInfo::is_valid_tvu_address(&node.tvu)
&& ContactInfo::is_valid_address(&node.tvu, &self.socket_addr_space)
&& ContactInfo::is_valid_address(&node.serve_repair, &self.socket_addr_space)
&& match gossip_crds.get::<&LowestSlot>(node.id) {
None => true, // fallback to legacy behavior

View File

@ -199,16 +199,9 @@ impl LegacyContactInfo {
/// port must not be 0
/// ip must be specified and not multicast
/// loopback ip is only allowed in tests
// Keeping this for now not to break tvu-peers and turbine shuffle order of
// nodes when arranging nodes on retransmit tree. Private IP addresses in
// turbine are filtered out just before sending packets.
pub(crate) fn is_valid_tvu_address(addr: &SocketAddr) -> bool {
(addr.port() != 0) && Self::is_valid_ip(addr.ip())
}
// TODO: Replace this entirely with streamer SocketAddrSpace.
pub fn is_valid_address(addr: &SocketAddr, socket_addr_space: &SocketAddrSpace) -> bool {
Self::is_valid_tvu_address(addr) && socket_addr_space.check(addr)
addr.port() != 0u16 && Self::is_valid_ip(addr.ip()) && socket_addr_space.check(addr)
}
pub fn client_facing_addr(&self) -> (SocketAddr, SocketAddr) {