aboutsummaryrefslogtreecommitdiffstats
path: root/p2p
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2018-02-16 23:05:08 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-02-16 23:05:08 +0800
commit32301a4d6b3a9684e954057e7cdb15998764122b (patch)
tree62cd36e5912ce14e3665f9e3a246fda95271210c /p2p
parent4e61ed02e2d32aa38f5a2f37b87bc52a71657809 (diff)
downloadgo-tangerine-32301a4d6b3a9684e954057e7cdb15998764122b.tar
go-tangerine-32301a4d6b3a9684e954057e7cdb15998764122b.tar.gz
go-tangerine-32301a4d6b3a9684e954057e7cdb15998764122b.tar.bz2
go-tangerine-32301a4d6b3a9684e954057e7cdb15998764122b.tar.lz
go-tangerine-32301a4d6b3a9684e954057e7cdb15998764122b.tar.xz
go-tangerine-32301a4d6b3a9684e954057e7cdb15998764122b.tar.zst
go-tangerine-32301a4d6b3a9684e954057e7cdb15998764122b.zip
p2p/discover: validate bond against lastpong, not db presence
Diffstat (limited to 'p2p')
-rw-r--r--p2p/discover/udp.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/p2p/discover/udp.go b/p2p/discover/udp.go
index e40de2c36..5cc0b3d74 100644
--- a/p2p/discover/udp.go
+++ b/p2p/discover/udp.go
@@ -613,7 +613,7 @@ func (req *findnode) handle(t *udp, from *net.UDPAddr, fromID NodeID, mac []byte
if expired(req.Expiration) {
return errExpired
}
- if t.db.node(fromID) == nil {
+ if age := time.Since(t.db.lastPong(fromID)); age > nodeDBNodeExpiration {
// 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