{"id":"XE-13306","kind":"bounty","visibility":"public","source":"github","source_repo":"xeprotocol/xe","source_ref":"451","source_url":"https://github.com/xeprotocol/xe/issues/451","reporter_id":2483,"title":"[net/gossip.go] H5: handleMessage() tidak handle duplicate message — waste resource","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:09.053163+00:00","updated_at":"2026-11-20T00:51:21.396516+00:00","source_created_at":"2026-11-12T02:54:13+00:00","told_at":"2026-11-20T00:50:26+00:00","status_changed_at":"2026-11-20T00:33:26.663398+00:00","url":"https://bounty.xe.network/XE-13306","body":"## Ringkasan\n`handleMessage` tidak cek apakah message sudah pernah diterima. Kalau message di-broadcast berulang, handler memproses message yang sama berulang kali.\n\n## Lokasi\n- File: `net/gossip.go`\n- Lines: 246-280\n\n## Kode\n```go\nfunc (g *Gossip) handleMessage(msg GossipMessage) {\n    ...\n    // tidak ada check apakah message sudah pernah diterima\n    switch msg.Type {\n    case GossipMessageTypeSync:\n        g.handleSyncMessage(msg)\n    case GossipMessageTypeAnnounce:\n        g.handleAnnounceMessage(msg)\n    }\n}\n```\n\n## Impact\nWaste resource kalau message di-broadcast berulang. Bisa menyebabkan infinite loop kalau message terus di-broadcast.\n\n## Suggested Fix\n```go\nfunc (g *Gossip) handleMessage(msg GossipMessage) {\n    ...\n    // cek apakah message sudah pernah diterima\n    msgID := msg.ID()\n    g.mu.Lock()\n    if g.seenMessages[msgID] {\n        g.mu.Unlock()\n        return\n    }\n    g.seenMessages[msgID] = true\n    g.mu.Unlock()\n    \n    // cleanup periodic\n    go g.cleanupSeenMessages()\n    \n    switch msg.Type {\n    case GossipMessageTypeSync:\n        g.handleSyncMessage(msg)\n    case GossipMessageTypeAnnounce:\n        g.handleAnnounceMessage(msg)\n    }\n}\n\nfunc (g *Gossip) cleanupSeenMessages() {\n    g.mu.Lock()\n    now := time.Now()\n    for id, t := range g.seenMessages {\n        if now.Sub(t) > 5*time.Minute {\n            delete(g.seenMessages, id)\n        }\n    }\n    g.mu.Unlock()\n}\n```","patch_refs":[],"thread":[{"id":13399,"source":"github","source_ref":"7026811945","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-13306 and says what; it is read like any other.","created_at":"2026-11-20T00:50:26+00:00"}]}