Skip to content

Commit

Permalink
asserts that socket addresses set in new_with_external_ip are valid (s…
Browse files Browse the repository at this point in the history
…olana-labs#32860)

new_with_external_ip silently ignores errors when setting socket
addresses which makes it harder to catch bugs:
https://github.com/solana-labs/solana/blob/7beeb8310/gossip/src/cluster_info.rs#L3054-L3063
  • Loading branch information
behzadnouri authored Aug 16, 2023
1 parent 7beeb83 commit a9ecdc0
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions gossip/src/cluster_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3051,16 +3051,19 @@ impl Node {
0u16, // shred_version
);
let addr = gossip_addr.ip();
let _ = info.set_gossip((addr, gossip_port));
let _ = info.set_tvu((addr, tvu_port));
let _ = info.set_tvu_quic((addr, tvu_quic_port));
let _ = info.set_tpu(public_tpu_addr.unwrap_or_else(|| SocketAddr::new(addr, tpu_port)));
let _ = info.set_tpu_forwards(
info.set_gossip((addr, gossip_port)).unwrap();
info.set_tvu((addr, tvu_port)).unwrap();
info.set_tvu_quic((addr, tvu_quic_port)).unwrap();
info.set_tpu(public_tpu_addr.unwrap_or_else(|| SocketAddr::new(addr, tpu_port)))
.unwrap();
info.set_tpu_forwards(
public_tpu_forwards_addr.unwrap_or_else(|| SocketAddr::new(addr, tpu_forwards_port)),
);
let _ = info.set_tpu_vote((addr, tpu_vote_port));
let _ = info.set_serve_repair((addr, serve_repair_port));
let _ = info.set_serve_repair_quic((addr, serve_repair_quic_port));
)
.unwrap();
info.set_tpu_vote((addr, tpu_vote_port)).unwrap();
info.set_serve_repair((addr, serve_repair_port)).unwrap();
info.set_serve_repair_quic((addr, serve_repair_quic_port))
.unwrap();
trace!("new ContactInfo: {:?}", info);

Node {
Expand Down

0 comments on commit a9ecdc0

Please sign in to comment.