don't forward messages with source ourselves but not published by ourselves
per stebalien's request.
This commit is contained in:
parent
0cab7f5e59
commit
ea314605d3
|
@ -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{}{}
|
||||
|
|
Loading…
Reference in New Issue