p2p: use slices.Contains

Signed-off-by: deepdring <deepdrink@icloud.com>
This commit is contained in:
deepdring 2025-08-14 22:37:58 +08:00
parent 2dbb580f51
commit 8b9b816da3

View file

@ -182,10 +182,8 @@ func (p *Peer) Caps() []Cap {
// versions is supported by both this node and the peer p.
func (p *Peer) RunningCap(protocol string, versions []uint) bool {
if proto, ok := p.running[protocol]; ok {
for _, ver := range versions {
if proto.Version == ver {
return true
}
if slices.Contains(versions, proto.Version) {
return true
}
}
return false