Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove self-profiles from incoming gossip #3946

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions jormungandr/src/topology/topology.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,20 @@ impl P2pTopology {
let peer = Profile::from_gossip(gossip);
let peer_id = NodeId(peer.id());
tracing::trace!(addr = %peer.address(), %peer_id, "received peer from incoming gossip");

// We do not support hosting multiple nodes at the same address at the moment.
// One problem with it is that routing new connections is a non-trivial task,
// plus we can rely on this to easily remove self_profile from incoming gossips.
// Such occurrences are usually the result of a restart of a node.
if peer.address() == self.topology.self_profile().address()
|| peer.id() == self.topology.self_profile().id()
{
tracing::warn!(
"gossip peer is using the address or id of the current node, ignoring..."
);
continue;
}

if self.topology.add_peer(peer) {
self.quarantine.record_new_gossip(&peer_id);
self.stats_counter
Expand Down