From c058d1a960d5d9ab0464f1fa006a1f788156e1ea Mon Sep 17 00:00:00 2001 From: Giacomo Pasini Date: Wed, 20 Apr 2022 10:24:51 +0200 Subject: [PATCH 1/2] Remove self_profiles from incoming gossip Filter incoming gossips to avoid stale or duplicate definitions of the current node, which will later cause confusion in the topology. This implies we won't be supporting hosting multiple nodes at the same address, but that would have required additional work and does not seem particularly useful at the moment. --- jormungandr/src/topology/topology.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/jormungandr/src/topology/topology.rs b/jormungandr/src/topology/topology.rs index 7b22bf068b..a6ae6ce218 100644 --- a/jormungandr/src/topology/topology.rs +++ b/jormungandr/src/topology/topology.rs @@ -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 From 623bca04a8860061d17722146c8c4ffec3dc9221 Mon Sep 17 00:00:00 2001 From: Giacomo Pasini Date: Wed, 20 Apr 2022 11:43:46 +0200 Subject: [PATCH 2/2] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 73346a0f93..52e252806f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased +- Discard incoming gossips with either the same address or id as the current node - fix incorrect keys bech32 HRP by always using the ones provided by the library - update REST API: add new endpoint AccountVotes (`/api/v1/votes/plan/account-votes/{account_id}`) - Support parallel lanes in spending counters on account outputs. This allows