p2p/discover: don't update endpoint for unauthenticated nodes in discv4

This commit is contained in:
lightclient 2024-05-27 14:36:38 +02:00 committed by Felix Lange
parent af0a3274be
commit 7afcb398e5

View file

@ -513,6 +513,14 @@ func (tab *Table) handleAddNode(req addNodeOp) bool {
} }
b := tab.bucket(req.node.ID()) 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) { if tab.bumpInBucket(b, req.node.Node) {
// Already in bucket, update record. // Already in bucket, update record.
return false return false