mirror of https://github.com/status-im/nim-eth.git
discv5: Add check on ip address after handshake
This commit is contained in:
parent
65bed1ae94
commit
abc61e188a
|
@ -218,8 +218,11 @@ proc receive*(d: Protocol, a: Address, msg: Bytes) {.gcsafe,
|
||||||
if node.isNil:
|
if node.isNil:
|
||||||
node = d.routingTable.getNode(sender)
|
node = d.routingTable.getNode(sender)
|
||||||
else:
|
else:
|
||||||
debug "Adding new node to routing table", node = $node, localNode = $d.localNode
|
# Not filling table with nodes without correct IP in the ENR
|
||||||
discard d.routingTable.addNode(node)
|
if a.ip == node.address.ip:
|
||||||
|
debug "Adding new node to routing table", node = $node,
|
||||||
|
localNode = $d.localNode
|
||||||
|
discard d.routingTable.addNode(node)
|
||||||
|
|
||||||
case packet.kind
|
case packet.kind
|
||||||
of ping:
|
of ping:
|
||||||
|
@ -241,8 +244,10 @@ proc receive*(d: Protocol, a: Address, msg: Bytes) {.gcsafe,
|
||||||
# Still adding the node in case there is a packet error (could be
|
# Still adding the node in case there is a packet error (could be
|
||||||
# unsupported packet)
|
# unsupported packet)
|
||||||
if not node.isNil:
|
if not node.isNil:
|
||||||
debug "Adding new node to routing table", node = $node, localNode = $d.localNode
|
if a.ip == node.address.ip:
|
||||||
discard d.routingTable.addNode(node)
|
debug "Adding new node to routing table", node = $node,
|
||||||
|
localNode = $d.localNode
|
||||||
|
discard d.routingTable.addNode(node)
|
||||||
|
|
||||||
proc processClient(transp: DatagramTransport,
|
proc processClient(transp: DatagramTransport,
|
||||||
raddr: TransportAddress): Future[void] {.async, gcsafe.} =
|
raddr: TransportAddress): Future[void] {.async, gcsafe.} =
|
||||||
|
|
Loading…
Reference in New Issue