p2p/discover: remove the node

This commit is contained in:
Felix Lange 2024-05-28 16:51:22 +02:00
parent 1fc3290b32
commit d1e0495d70

View file

@ -224,16 +224,16 @@ func (list *revalidationList) push(n *node, now mclock.AbsTime, rand randomSourc
n.revalList = list n.revalList = list
} }
func (list *revalidationList) remove(n *node) bool { func (list *revalidationList) remove(n *node) {
i := slices.Index(list.nodes, n) i := slices.Index(list.nodes, n)
if i == -1 { if i == -1 {
return false panic(fmt.Errorf("node %v not found in list", n.ID()))
} }
list.nodes = slices.Delete(list.nodes, i, i+1) list.nodes = slices.Delete(list.nodes, i, i+1)
n.revalList = nil
if len(list.nodes) == 0 { if len(list.nodes) == 0 {
list.nextTime = never list.nextTime = never
} }
return true
} }
func (list *revalidationList) contains(id enode.ID) bool { func (list *revalidationList) contains(id enode.ID) bool {