Skip to content

Commit 32301a4

Browse files
committed
p2p/discover: validate bond against lastpong, not db presence
1 parent 4e61ed0 commit 32301a4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

p2p/discover/udp.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ func (req *findnode) handle(t *udp, from *net.UDPAddr, fromID NodeID, mac []byte
613613
if expired(req.Expiration) {
614614
return errExpired
615615
}
616-
if t.db.node(fromID) == nil {
616+
if age := time.Since(t.db.lastPong(fromID)); age > nodeDBNodeExpiration {
617617
// No bond exists, we don't process the packet. This prevents
618618
// an attack vector where the discovery protocol could be used
619619
// to amplify traffic in a DDOS attack. A malicious actor

0 commit comments

Comments
 (0)