From bde6a921ca838277103a99825076e2b2948dfe89 Mon Sep 17 00:00:00 2001 From: Cassandra Heart Date: Wed, 1 Nov 2023 20:08:19 -0500 Subject: [PATCH] fix: resolve bad peer info spam --- node/consensus/ceremony/broadcast_messaging.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/node/consensus/ceremony/broadcast_messaging.go b/node/consensus/ceremony/broadcast_messaging.go index 4c64ddf..c4e9d06 100644 --- a/node/consensus/ceremony/broadcast_messaging.go +++ b/node/consensus/ceremony/broadcast_messaging.go @@ -232,6 +232,24 @@ func (e *CeremonyDataClockConsensusEngine) handleCeremonyPeerListAnnounce( } e.pubSub.SetPeerScore(p.PeerId, 10) + existing, ok := e.peerMap[string(p.PeerId)] + if ok { + if existing.signature != nil && p.Signature == nil { + continue + } + + if existing.publicKey != nil && p.PublicKey == nil { + continue + } + + if existing.version != nil && p.Version == nil { + continue + } + + if existing.timestamp > p.Timestamp { + continue + } + } e.peerMap[string(p.PeerId)] = &peerInfo{ peerId: p.PeerId,