eth: check snap satelliteness, delegate drop to eth (#22235)

* eth: check snap satelliteness, delegate drop to eth

* eth: better handle eth/snap satellite relation, merge reg/unreg paths
This commit is contained in:
Péter Szilágyi
2021-02-02 10:44:36 +02:00
committed by GitHub
parent 3c728fb129
commit e3430ac7df
13 changed files with 217 additions and 252 deletions

View File

@ -158,11 +158,16 @@ func (p *Peer) Caps() []Cap {
return p.rw.caps
}
// SupportsCap returns true if the peer supports the given protocol/version
func (p *Peer) SupportsCap(protocol string, version uint) bool {
// SupportsCap returns true if the peer supports any of the enumerated versions
// of a specific protocol.
func (p *Peer) SupportsCap(protocol string, versions []uint) bool {
for _, cap := range p.rw.caps {
if cap.Name == protocol {
return version <= cap.Version
for _, ver := range versions {
if cap.Version == ver {
return true
}
}
}
}
return false