From ed97517ff4db1982251d8bf7dbeca565159e3604 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Mon, 8 Apr 2019 13:35:11 +0200 Subject: [PATCH] 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. --- p2p/discover/table.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/p2p/discover/table.go b/p2p/discover/table.go index ef0c08afce..3e9353753d 100644 --- a/p2p/discover/table.go +++ b/p2p/discover/table.go @@ -313,7 +313,7 @@ func (tab *Table) findnode(n *node, targetKey encPubkey, reply chan<- []*node) { // Avoid recording failures on shutdown. reply <- nil return - } else if err != nil || len(r) == 0 { + } else if len(r) == 0 { fails++ tab.db.UpdateFindFails(n.ID(), n.IP(), fails) log.Trace("Findnode failed", "id", n.ID(), "failcount", fails, "err", err)