<!-- XE-13285 · [net/netcheck.go] L14: verifyPeer() tidak handle timeout pada stream creation — blocking resource · testnet -->
*Markdown view of <https://bounty.xe.network/XE-13285>. The page is the record; this is the same page for reading.*

XE-13285 · Bounty

# \[net/netcheck.go\] L14: verifyPeer() tidak handle timeout pada stream creation — blocking resource

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

Verdict
:   Duplicate

Tier
:   —

Claimed
:   —

Area
:   P2P / sync

Duplicate of
:   —

Tracked
:   —

Updated
:   2026-11-20 00:38 UTC

Told
:   2026-11-20 00:34 UTC

### Patches

None linked.

### History

- [554021](https://bounty.xe.network/log/554021) 2026-11-20 00:34 UTC reply.mirrored
- [554006](https://bounty.xe.network/log/554006) 2026-11-20 00:34 UTC github.state\_pushed
- [554005](https://bounty.xe.network/log/554005) 2026-11-20 00:34 UTC github.labels
- [552499](https://bounty.xe.network/log/552499) 2026-11-20 00:33 UTC proposal.adopted
- [552498](https://bounty.xe.network/log/552498) 2026-11-20 00:33 UTC reply.sent
- [552497](https://bounty.xe.network/log/552497) 2026-11-20 00:33 UTC ticket.status new → closed
- [551900](https://bounty.xe.network/log/551900) 2026-11-20 00:33 UTC proposal.adopted
- [551899](https://bounty.xe.network/log/551899) 2026-11-20 00:33 UTC ticket.facts area
- [551898](https://bounty.xe.network/log/551898) 2026-11-20 00:33 UTC proposal.adopted
- [551897](https://bounty.xe.network/log/551897) 2026-11-20 00:33 UTC ticket.facts
- [551896](https://bounty.xe.network/log/551896) 2026-11-20 00:33 UTC proposal.adopted
- [551895](https://bounty.xe.network/log/551895) 2026-11-20 00:33 UTC ticket.facts

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

### Report

## Ringkasan

`verifyPeer` pakai `netcheckTimeout = 5 * time.Second` untuk stream, tapi kalau stream creation gagal karena timeout, error hanya di-log dan peer di-close. Tidak ada retry.

## Lokasi

- File: `net/netcheck.go`
- Lines: 418-471

## Kode

```
func (g *NetworkGater) verifyPeer(ctx context.Context, pid peer.ID) {
    ...
    s, err := g.h.NewStream(ctx, pid, NetcheckProtocolID)
    if err != nil {
        logging.Debugf("netcheck: failed to open stream to %s: %v", pid, err)
        _ = g.h.Network().ClosePeer(pid)
        return
    }
    defer s.Close()
    ...
}
```

## Impact

Peer yang gagal verify hanya di-close sekali. Kalau peer tersebut later connect lagi, tidak ada retry mechanism.

## Suggested Fix

```
func (g *NetworkGater) verifyPeer(ctx context.Context, pid peer.ID) {
    ...
    var lastErr error
    for i := 0; i < 3; i++ {
        s, err := g.h.NewStream(ctx, pid, NetcheckProtocolID)
        if err == nil {
            defer s.Close()
            ...
            return
        }
        lastErr = err
        logging.Debugf("netcheck: failed to open stream to %s (attempt %d): %v", pid, i+1, err)
        time.Sleep(time.Second * time.Duration(i+1))
    }
    logging.Warnf("netcheck: failed to verify %s after 3 attempts: %v", pid, lastErr)
    _ = g.h.Network().ClosePeer(pid)
}
```

### Thread

**Joseph Denne**team2026-11-20 00:34 UTCgithub

Thanks. This is the same finding as an earlier report that is not public, which was filed first; the programme pays the
first verifiable submission, so this one closes as a duplicate. If you believe it is a different
bug, file a new report that links https://bounty.xe.network/XE-13285 and says what differs; it is read like any other.
