diff --git a/p2p/peer.go b/p2p/peer.go index 4b7e222b5f21..ab659b5cf06a 100644 --- a/p2p/peer.go +++ b/p2p/peer.go @@ -365,7 +365,12 @@ func countMatchingProtocols(protocols []Protocol, caps []Cap) int { n := 0 for _, cap := range caps { for _, proto := range protocols { - if proto.Name == cap.Name && proto.Version == cap.Version { + if proto.Match == nil { + proto.Match = func(cap Cap) bool { + return proto.Name == cap.Name && proto.Version == cap.Version + } + } + if proto.Match(cap) { n++ } }