Skip to content

Commit 81477ca

Browse files
thinkAfCodGrapeBaBa
authored andcommitted
fix: not cache nil node
1 parent 12182b4 commit 81477ca

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

p2p/discover/portal_protocol.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,9 @@ func (p *PortalProtocol) cacheNodeById(id enode.ID, addr *net.UDPAddr) {
401401
go func() {
402402
if _, ok := p.cachedIds[addr.String()]; !ok {
403403
n := p.ResolveNodeId(id)
404-
p.cacheNode(n)
404+
if n != nil {
405+
p.cacheNode(n)
406+
}
405407
}
406408
}()
407409
}

0 commit comments

Comments
 (0)