<!-- XE-13306 · [net/gossip.go] H5: handleMessage() tidak handle duplicate message — waste resource · testnet -->
*Markdown view of <https://bounty.xe.network/XE-13306>. The page is the record; this is the same page for reading.*

XE-13306 · Bounty

# \[net/gossip.go\] H5: handleMessage() tidak handle duplicate message — waste resource

Closed · invalid
—
[xe#451](https://github.com/xeprotocol/xe/issues/451)
filed 2026-11-12 02:54 UTC
by wahyu20260100233-ops

Verdict
:   Invalid

Tier
:   —

Claimed
:   —

Area
:   P2P / sync

Duplicate of
:   —

Tracked
:   —

Updated
:   2026-11-20 00:51 UTC

Told
:   2026-11-20 00:50 UTC

### Patches

None linked.

### History

- [559444](https://bounty.xe.network/log/559444) 2026-11-20 00:50 UTC reply.mirrored
- [558510](https://bounty.xe.network/log/558510) 2026-11-20 00:49 UTC reply.sent
- [554259](https://bounty.xe.network/log/554259) 2026-11-20 00:37 UTC github.state\_pushed
- [554251](https://bounty.xe.network/log/554251) 2026-11-20 00:37 UTC github.labels
- [553377](https://bounty.xe.network/log/553377) 2026-11-20 00:33 UTC proposal.adopted
- [553211](https://bounty.xe.network/log/553211) 2026-11-20 00:33 UTC proposal.adopted
- [553210](https://bounty.xe.network/log/553210) 2026-11-20 00:33 UTC ticket.status new → closed
- [552890](https://bounty.xe.network/log/552890) 2026-11-20 00:33 UTC proposal.adopted
- [552889](https://bounty.xe.network/log/552889) 2026-11-20 00:33 UTC ticket.facts area
- [552887](https://bounty.xe.network/log/552887) 2026-11-20 00:33 UTC proposal.adopted
- [552886](https://bounty.xe.network/log/552886) 2026-11-20 00:33 UTC ticket.facts
- [550358](https://bounty.xe.network/log/550358) 2026-11-20 00:28 UTC note.added

[Full history](https://bounty.xe.network/log?ref=XE-13306) · [JSON](https://bounty.xe.network/v1/tickets/XE-13306) · [markdown](https://bounty.xe.network/XE-13306.md)

### 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 desk**team2026-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.
