XE-13296 · Bounty
[net/sync.go] M10: syncPeer() tidak cek apakah peer sudah sync — sync berulang tidak perlu
Report
Ringkasan
syncPeer tidak cek apakah peer tersebut sudah sync. Kalau SyncAll dipanggil berulang, peer yang sudah sync tetap diseret. Waste resource.
Lokasi
- File:
net/sync.go - Lines: 248-274
Kode
func (t *tracker) syncPeer(ctx context.Context, h host.Host, pid peer.ID, opts ...SyncOption) error {
...
// tidak ada check apakah peer sudah sync
if err := t.doFullSync(ctx, h, pid, opts...); err != nil {
return err
}
return nil
}
Impact
Sync berulang tidak perlu. Waste resource.
Suggested Fix
func (t *tracker) syncPeer(ctx context.Context, h host.Host, pid peer.ID, opts ...SyncOption) error {
...
t.mu.RLock()
lastSync := t.lastSync[pid]
t.mu.RUnlock()
if time.Since(lastSync) < opts.syncInterval {
return nil // skip jika baru saja sync
}
if err := t.doFullSync(ctx, h, pid, opts...); err != nil {
return err
}
return nil
}
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-13296 and says what; it is read like any other.