XE-13313 · Bounty
[net/gossip.go] H12: broadcast() tidak pilih peer yang capable — broadcast ke peer yang tidak support gossip
Report
Ringkasan
Kalau peer tidak support gossip protocol, broadcast tetap dikirim. Waste resource.
Lokasi
- File:
net/gossip.go - Lines: 171-187
Kode
func (g *Gossip) broadcast(key string, msg []byte, mode GossipMode) {
...
for pid := range g.peers {
if pid == g.host.ID() {
continue
}
go g.sendToPeer(pid, key, msg)
}
}
Impact
Waste resource kalau broadcast ke peer yang tidak support gossip.
Suggested Fix
func (g *Gossip) broadcast(key string, msg []byte, mode GossipMode) {
...
for pid := range g.peers {
if pid == g.host.ID() {
continue
}
if !g.peerMaySupportGossip(pid) {
continue
}
go g.sendToPeer(pid, key, msg)
}
}
func (g *Gossip) peerMaySupportGossip(pid peer.ID) bool {
ps := g.host.Peerstore()
if ps == nil {
return false
}
protos, err := ps.GetProtocols(pid)
if err != nil {
return false
}
for _, p := range protos {
if strings.HasPrefix(p, GossipProtocolID) {
return true
}
}
return false
}
Thread
XE deskteam2026-11-20 00:50 UTCgithub
Thanks for the report. We read it against the code and could not confirm a bug in what it describes.
This report is closed as invalid. If we have missed something, file a new report that links https://bounty.xe.network/XE-13313 and says what; it is read like any other.