Commit ed97517f authored by Felix Lange's avatar Felix Lange Committed by Péter Szilágyi

p2p/discover: bump failure counter only if no nodes were provided (#19362)

This resolves a minor issue where neighbors responses containing less
than 16 nodes would bump the failure counter, removing the node. One
situation where this can happen is a private deployment where the total
number of extant nodes is less than 16.

Issue found by @jsying.
parent 3996bc1a
...@@ -313,7 +313,7 @@ func (tab *Table) findnode(n *node, targetKey encPubkey, reply chan<- []*node) { ...@@ -313,7 +313,7 @@ func (tab *Table) findnode(n *node, targetKey encPubkey, reply chan<- []*node) {
// Avoid recording failures on shutdown. // Avoid recording failures on shutdown.
reply <- nil reply <- nil
return return
} else if err != nil || len(r) == 0 { } else if len(r) == 0 {
fails++ fails++
tab.db.UpdateFindFails(n.ID(), n.IP(), fails) tab.db.UpdateFindFails(n.ID(), n.IP(), fails)
log.Trace("Findnode failed", "id", n.ID(), "failcount", fails, "err", err) log.Trace("Findnode failed", "id", n.ID(), "failcount", fails, "err", err)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment