fix: resolve bad peer info spam

This commit is contained in:
Cassandra Heart 2023-11-01 20:08:19 -05:00
parent 76089a1157
commit bde6a921ca
No known key found for this signature in database
GPG Key ID: 6352152859385958

View File

@ -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,