<!-- XE-13290 · [net/host.go] M4: HandlePeerFound() tidak cek apakah peer sudah connected — connect attempt berulang · testnet -->
*Markdown view of <https://bounty.xe.network/XE-13290>. The page is the record; this is the same page for reading.*

XE-13290 · Bounty

# \[net/host.go\] M4: HandlePeerFound() tidak cek apakah peer sudah connected — connect attempt berulang

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

- [557838](https://bounty.xe.network/log/557838) 2026-11-20 00:49 UTC reply.mirrored
- [557090](https://bounty.xe.network/log/557090) 2026-11-20 00:48 UTC reply.sent
- [554247](https://bounty.xe.network/log/554247) 2026-11-20 00:37 UTC github.state\_pushed
- [554239](https://bounty.xe.network/log/554239) 2026-11-20 00:37 UTC github.labels
- [553362](https://bounty.xe.network/log/553362) 2026-11-20 00:33 UTC proposal.adopted
- [553176](https://bounty.xe.network/log/553176) 2026-11-20 00:33 UTC proposal.adopted
- [553175](https://bounty.xe.network/log/553175) 2026-11-20 00:33 UTC ticket.status new → closed
- [552820](https://bounty.xe.network/log/552820) 2026-11-20 00:33 UTC proposal.adopted
- [552819](https://bounty.xe.network/log/552819) 2026-11-20 00:33 UTC ticket.facts area
- [552818](https://bounty.xe.network/log/552818) 2026-11-20 00:33 UTC proposal.adopted
- [552817](https://bounty.xe.network/log/552817) 2026-11-20 00:33 UTC ticket.facts
- [550748](https://bounty.xe.network/log/550748) 2026-11-20 00:30 UTC note.added

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

### Report

## Ringkasan

Hanya skip diri sendiri (`pi.ID == n.h.ID()`). Peer yang sudah connected tetap di-connect lagi. Meskipun libp2p mungkin idempotent, ada overhead dan potensi log error yang tidak perlu.

## Lokasi

- File: `net/host.go`
- Lines: 201-209

## Kode

```
func (n *discoveryNotifee) HandlePeerFound(pi peer.AddrInfo) {
    if pi.ID == n.h.ID() {
        return
    }
    if err := n.h.Connect(n.ctx, pi); err != nil {
        logging.Warnf("Failed to connect to %s: %v", pi.ID.ShortString(), err)
    }
}
```

## Impact

Connect attempt berulang ke peer yang sudah connected. Overhead, log error yang tidak perlu.

## Suggested Fix

```
func (n *discoveryNotifee) HandlePeerFound(pi peer.AddrInfo) {
    if pi.ID == n.h.ID() {
        return
    }
    // cek apakah sudah connected
    if n.h.Network().Connectedness(pi.ID) == network.Connected {
        return
    }
    if err := n.h.Connect(n.ctx, pi); err != nil {
        logging.Warnf("Failed to connect to %s: %v", pi.ID.ShortString(), err)
    }
}
```

### 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-13290 and says what; it is read like any other.
