XE-13293 · Bounty
[net/sync.go] M7: peerMaySupportSync() terlalu permisif — peer yang tidak support sync tetap diseret
Report
Ringkasan
Kalau peerstore gagal mengambil protokol atau return list kosong, fungsi return true. Peer yang tidak support sync tetap diseret ke sync attempt.
Lokasi
- File:
net/sync.go - Lines: 759-775
Kode
func peerMaySupportSync(h host.Host, pid peer.ID) bool {
ps := h.Peerstore()
if ps == nil {
return true
}
protos, err := ps.GetProtocols(pid)
if err != nil || len(protos) == 0 {
return true // terlalu permisif
}
for _, p := range protos {
if strings.HasPrefix(p, SyncProtocolPrefix) {
return true
}
}
return false
}
Impact
Peer yang tidak support sync tetap diseret ke sync attempt. Waste resource, potensi error.
Suggested Fix
func peerMaySupportSync(h host.Host, pid peer.ID) bool {
ps := h.Peerstore()
if ps == nil {
return false // lebih konservatif
}
protos, err := ps.GetProtocols(pid)
if err != nil {
logging.Debugf("sync: failed to get protocols for %s: %v", pid, err)
return false
}
if len(protos) == 0 {
return false
}
for _, p := range protos {
if strings.HasPrefix(p, SyncProtocolPrefix) {
return true
}
}
return false
}
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-13293 and says what; it is read like any other.