<!-- XE-13281 · [net/gossip.go] L10: GossipUnicast ke banyak peer tanpa limit — network congestion · testnet -->
*Markdown view of <https://bounty.xe.network/XE-13281>. The page is the record; this is the same page for reading.*

XE-13281 · Bounty

# \[net/gossip.go\] L10: GossipUnicast ke banyak peer tanpa limit — network congestion

Closed · invalid
—
[xe#426](https://github.com/xeprotocol/xe/issues/426)
filed 2026-11-12 02:49 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:49 UTC

### Patches

None linked.

### History

- [557286](https://bounty.xe.network/log/557286) 2026-11-20 00:49 UTC reply.mirrored
- [557058](https://bounty.xe.network/log/557058) 2026-11-20 00:48 UTC reply.sent
- [554048](https://bounty.xe.network/log/554048) 2026-11-20 00:35 UTC github.state\_pushed
- [554047](https://bounty.xe.network/log/554047) 2026-11-20 00:35 UTC github.labels
- [553331](https://bounty.xe.network/log/553331) 2026-11-20 00:33 UTC proposal.adopted
- [553122](https://bounty.xe.network/log/553122) 2026-11-20 00:33 UTC proposal.adopted
- [553121](https://bounty.xe.network/log/553121) 2026-11-20 00:33 UTC ticket.status new → closed
- [552542](https://bounty.xe.network/log/552542) 2026-11-20 00:33 UTC proposal.adopted
- [552541](https://bounty.xe.network/log/552541) 2026-11-20 00:33 UTC ticket.facts area
- [552537](https://bounty.xe.network/log/552537) 2026-11-20 00:33 UTC proposal.adopted
- [552536](https://bounty.xe.network/log/552536) 2026-11-20 00:33 UTC ticket.facts
- [551109](https://bounty.xe.network/log/551109) 2026-11-20 00:31 UTC note.added

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

### Report

## Ringkasan

`broadcast` dengan mode `GossipUnicast` mengirim ke semua peer dalam `peers` map. Tidak ada limit pada jumlah peer. Kalau ada banyak peer, bisa menyebabkan network congestion.

## Lokasi

- File: `net/gossip.go`
- Lines: 171-187

## Kode

```
func (g *Gossip) broadcast(key string, msg []byte, mode GossipMode) {
    switch mode {
    case GossipUnicast:
        for pid := range g.peers {
            if pid == g.host.ID() {
                continue
            }
            go g.sendToPeer(pid, key, msg)
        }
    }
}
```

## Impact

Kalau ada banyak peer (misal 1000\+), broadcast akan spawn 1000\+ goroutine sekaligus. Network congestion, resource exhaustion.

## Suggested Fix

```
func (g *Gossip) broadcast(key string, msg []byte, mode GossipMode) {
    switch mode {
    case GossipUnicast:
        peers := make([]peer.ID, 0, len(g.peers))
        for pid := range g.peers {
            if pid == g.host.ID() {
                continue
            }
            peers = append(peers, pid)
        }
        // random sampling jika terlalu banyak
        if len(peers) > 50 {
            rand.Shuffle(len(peers), func(i, j int) {
                peers[i], peers[j] = peers[j], peers[i]
            })
            peers = peers[:50]
        }
        for _, pid := range peers {
            go g.sendToPeer(pid, key, msg)
        }
    }
}
```

### Thread

**XE desk**team2026-11-20 00:49 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-13281 and says what; it is read like any other.
