{"id":"XE-13280","kind":"bounty","visibility":"public","source":"github","source_repo":"xeprotocol/xe","source_ref":"425","source_url":"https://github.com/xeprotocol/xe/issues/425","reporter_id":2483,"title":"[net/gossip.go] L9: rebroadcast() tidak rate-limit — potensi broadcast storm","area":"p2p-sync","claimed_tier":null,"assessed_tier":null,"verdict":"invalid","duplicate_of":null,"tracked":false,"internal_ref":"","internal_url":"","status":"closed","closed_reason":"invalid","github_state":"closed","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-14T20:42:07.148755+00:00","updated_at":"2026-11-20T00:51:12.352031+00:00","source_created_at":"2026-11-12T02:49:25+00:00","told_at":"2026-11-20T00:49:25+00:00","status_changed_at":"2026-11-20T00:33:25.867723+00:00","url":"https://bounty.xe.network/XE-13280","body":"## Ringkasan\nTidak ada rate-limit pada `rebroadcast`. Kalau banyak goroutine panggil `rebroadcast` bersamaan, bisa terjadi broadcast storm.\n\n## Lokasi\n- File: `net/gossip.go`\n- Lines: 189-203\n\n## Kode\n```go\nfunc (g *Gossip) rebroadcast(key string, msg []byte) {\n    if g.rebroadcastMutex.TryLock() {\n        defer g.rebroadcastMutex.Unlock()\n        g.broadcast(key, msg, GossipUnicast)\n        return\n    }\n    g.pendingRebroadcast.Add(1)\n}\n```\n\n## Impact\nBroadcast storm kalau banyak goroutine kompetisi. Network congestion, waste bandwidth.\n\n## Suggested Fix\n```go\nfunc (g *Gossip) rebroadcast(key string, msg []byte) {\n    if g.rebroadcastMutex.TryLock() {\n        defer g.rebroadcastMutex.Unlock()\n        g.broadcast(key, msg, GossipUnicast)\n        return\n    }\n    g.pendingRebroadcast.Add(1)\n    // rate-limit: tunggu sebentar sebelum retry\n    time.Sleep(time.Millisecond * 100)\n    // atau gunakan rate limiter per key\n}\n```\n\nAtau implement rate limiter per key:\n```go\ntype rateLimiter struct {\n    mu    sync.Mutex\n    last  map[string]time.Time\n    limit time.Duration\n}\n\nfunc (rl *rateLimiter) allow(key string) bool {\n    rl.mu.Lock()\n    defer rl.mu.Unlock()\n    now := time.Now()\n    if t, ok := rl.last[key]; ok && now.Sub(t) < rl.limit {\n        return false\n    }\n    rl.last[key] = now\n    return true\n}\n```","patch_refs":[],"thread":[{"id":13360,"source":"github","source_ref":"7026791301","author":"XE desk","team":true,"body":"Thanks for the report. We read it against the code and could not confirm a bug in what it describes.\n\nThis report is closed as invalid. If we have missed something, file a new report that links\nhttps://bounty.xe.network/XE-13280 and says what; it is read like any other.","created_at":"2026-11-20T00:49:25+00:00"}]}