From 7afcb398e53d1ba439da9fb40309e7686d736f11 Mon Sep 17 00:00:00 2001 From: lightclient Date: Mon, 27 May 2024 14:36:38 +0200 Subject: [PATCH] p2p/discover: don't update endpoint for unauthenticated nodes in discv4 --- p2p/discover/table.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/p2p/discover/table.go b/p2p/discover/table.go index 74c0e930e4..21a256bb9f 100644 --- a/p2p/discover/table.go +++ b/p2p/discover/table.go @@ -513,6 +513,14 @@ func (tab *Table) handleAddNode(req addNodeOp) bool { } b := tab.bucket(req.node.ID()) + if !req.isInbound && req.node.Seq() == 0 && contains(b.entries, req.node.ID()) { + // Special case for discv4: because endpoint information is not + // authenticated, do not update until the node is successfully communicated + // with. Therefore, non-inbounds which are already in the bucket should be + // skipped. + return false + + } if tab.bumpInBucket(b, req.node.Node) { // Already in bucket, update record. return false