don't forward messages with source ourselves but not published by ourselves

per stebalien's request.
This commit is contained in:
vyzo 2020-03-27 19:52:08 +02:00
parent 0cab7f5e59
commit ea314605d3
1 changed files with 7 additions and 1 deletions

View File

@ -556,6 +556,12 @@ func (gs *GossipSubRouter) connector() {
}
func (gs *GossipSubRouter) Publish(msg *Message) {
self := gs.p.host.ID()
if peer.ID(msg.GetFrom()) == self && msg.ReceivedFrom != self {
// we don't forward messages claiming to be from us but not published by ourselves
return
}
gs.mcache.Put(msg.Message)
from := msg.ReceivedFrom
@ -567,7 +573,7 @@ func (gs *GossipSubRouter) Publish(msg *Message) {
continue
}
if gs.floodPublish && from == gs.p.host.ID() {
if gs.floodPublish && from == self {
for p := range tmap {
if gs.score.Score(p) >= gs.publishThreshold {
tosend[p] = struct{}{}