mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 13:46:43 +00:00
p2p: use slices.Contains
Signed-off-by: deepdring <deepdrink@icloud.com>
This commit is contained in:
parent
2dbb580f51
commit
8b9b816da3
1 changed files with 2 additions and 4 deletions
|
|
@ -182,10 +182,8 @@ func (p *Peer) Caps() []Cap {
|
||||||
// versions is supported by both this node and the peer p.
|
// versions is supported by both this node and the peer p.
|
||||||
func (p *Peer) RunningCap(protocol string, versions []uint) bool {
|
func (p *Peer) RunningCap(protocol string, versions []uint) bool {
|
||||||
if proto, ok := p.running[protocol]; ok {
|
if proto, ok := p.running[protocol]; ok {
|
||||||
for _, ver := range versions {
|
if slices.Contains(versions, proto.Version) {
|
||||||
if proto.Version == ver {
|
return true
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue