diff --git a/p2p/discover/udp.go b/p2p/discover/udp.go index b2a895442..69e9f3c2e 100644 --- a/p2p/discover/udp.go +++ b/p2p/discover/udp.go @@ -253,7 +253,8 @@ func (t *udp) loop() { case reply := <-t.replies: // run matching callbacks, remove if they return false. - for i, p := range pending { + for i := 0; i < len(pending); i++ { + p := pending[i] if reply.from == p.from && reply.ptype == p.ptype && p.callback(reply.data) { p.errc <- nil copy(pending[i:], pending[i+1:])