Bounty
XE-13294 · Bounty

[net/sync.go] M8: SyncAll() tidak pilih peer yang capable — sync diminta ke semua peer

Closed · invalid — xe#439 filed 2026-11-12 02:51 UTC by wahyu20260100233-ops

Report

Ringkasan

SyncAll iterate semua peer dan panggil SyncTo untuk setiap peer yang connected. Tidak ada filter apakah peer tersebut support sync protocol. Peer yang tidak support sync tetap diseret.

Lokasi

  • File: net/sync.go
  • Lines: 100-122

Kode

func (t *tracker) SyncAll(ctx context.Context, h host.Host, opts ...SyncOption) {
    opt := applySyncOptions(opts...)
    t.mu.RLock()
    defer t.mu.RUnlock()
    for pid := range t.peers {
        if !isConnected(t.network, pid) {
            continue
        }
        if err := t.SyncTo(ctx, h, pid, opt); err != nil {
            logging.Warnf("sync: failed to sync with %s: %v", pid, err)
        }
    }
}

Impact

Peer yang tidak support sync tetap diseret. Waste resource, potensi error.

Suggested Fix

func (t *tracker) SyncAll(ctx context.Context, h host.Host, opts ...SyncOption) {
    opt := applySyncOptions(opts...)
    t.mu.RLock()
    defer t.mu.RUnlock()
    for pid := range t.peers {
        if !isConnected(t.network, pid) {
            continue
        }
        if !peerMaySupportSync(h, pid) {
            continue
        }
        if err := t.SyncTo(ctx, h, pid, opt); err != nil {
            logging.Warnf("sync: failed to sync with %s: %v", pid, err)
        }
    }
}

Thread

XE deskteam2026-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-13294 and says what; it is read like any other.