blossomsub: Avoid looping back unwanted messages (#384)

This commit is contained in:
petricadaipegsp 2024-11-25 00:03:57 +01:00 committed by GitHub
parent 86997630f0
commit 2c79fedfd0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -912,6 +912,13 @@ func (bs *BlossomSubRouter) handleIWant(p peer.ID, ctl *pb.ControlMessage) []*pb
msgs := make([]*pb.Message, 0, len(ihave))
for _, msg := range ihave {
if peer.ID(msg.GetFrom()) == p {
continue
}
mid := bs.p.idGen.RawID(msg)
if _, ok := bs.unwanted[p][string(mid)]; ok {
continue
}
msgs = append(msgs, msg)
}