XE-13306 · Bounty
[net/gossip.go] H5: handleMessage() tidak handle duplicate message — waste resource
Report
Ringkasan
handleMessage tidak cek apakah message sudah pernah diterima. Kalau message di-broadcast berulang, handler memproses message yang sama berulang kali.
Lokasi
- File:
net/gossip.go - Lines: 246-280
Kode
func (g *Gossip) handleMessage(msg GossipMessage) {
...
// tidak ada check apakah message sudah pernah diterima
switch msg.Type {
case GossipMessageTypeSync:
g.handleSyncMessage(msg)
case GossipMessageTypeAnnounce:
g.handleAnnounceMessage(msg)
}
}
Impact
Waste resource kalau message di-broadcast berulang. Bisa menyebabkan infinite loop kalau message terus di-broadcast.
Suggested Fix
func (g *Gossip) handleMessage(msg GossipMessage) {
...
// cek apakah message sudah pernah diterima
msgID := msg.ID()
g.mu.Lock()
if g.seenMessages[msgID] {
g.mu.Unlock()
return
}
g.seenMessages[msgID] = true
g.mu.Unlock()
// cleanup periodic
go g.cleanupSeenMessages()
switch msg.Type {
case GossipMessageTypeSync:
g.handleSyncMessage(msg)
case GossipMessageTypeAnnounce:
g.handleAnnounceMessage(msg)
}
}
func (g *Gossip) cleanupSeenMessages() {
g.mu.Lock()
now := time.Now()
for id, t := range g.seenMessages {
if now.Sub(t) > 5*time.Minute {
delete(g.seenMessages, id)
}
}
g.mu.Unlock()
}
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-13306 and says what; it is read like any other.