p2p/discover: s/lastPong/bondTime/, update TestUDP_findnode

I forgot to change the check in udp.go when I changed Table.bond to be
based on lastPong instead of node presence in db. Rename lastPong to
bondTime and add hasBond so it's clearer what this DB key is used for
now.
This commit is contained in:
Felix Lange
2018-02-16 20:16:23 +01:00
parent 32301a4d6b
commit aeedec4078
5 changed files with 26 additions and 25 deletions

View File

@@ -613,7 +613,7 @@ func (req *findnode) handle(t *udp, from *net.UDPAddr, fromID NodeID, mac []byte
if expired(req.Expiration) {
return errExpired
}
if age := time.Since(t.db.lastPong(fromID)); age > nodeDBNodeExpiration {
if !t.db.hasBond(fromID) {
// No bond exists, we don't process the packet. This prevents
// an attack vector where the discovery protocol could be used
// to amplify traffic in a DDOS attack. A malicious actor