From 86bceaa5d82542f1a2162844f13ab59aac012a15 Mon Sep 17 00:00:00 2001 From: kdeme Date: Sun, 1 Mar 2020 11:50:26 +0100 Subject: [PATCH] Add TODO comments from review --- eth/p2p/discoveryv5/protocol.nim | 2 ++ eth/p2p/discoveryv5/routing_table.nim | 1 + 2 files changed, 3 insertions(+) diff --git a/eth/p2p/discoveryv5/protocol.nim b/eth/p2p/discoveryv5/protocol.nim index f8bd3fe..7e46420 100644 --- a/eth/p2p/discoveryv5/protocol.nim +++ b/eth/p2p/discoveryv5/protocol.nim @@ -363,6 +363,8 @@ proc revalidateLoop(p: Protocol) {.async.} = await sleepAsync(rand(10 * 1000).milliseconds) let n = p.routingTable.nodeToRevalidate() if not n.isNil: + # TODO: Should we do these in parallel and/or async to be certain of how + # often nodes are revalidated? await p.revalidateNode(n) except CancelledError: trace "revalidateLoop canceled" diff --git a/eth/p2p/discoveryv5/routing_table.nim b/eth/p2p/discoveryv5/routing_table.nim index 1f5b76e..4a96699 100644 --- a/eth/p2p/discoveryv5/routing_table.nim +++ b/eth/p2p/discoveryv5/routing_table.nim @@ -239,6 +239,7 @@ proc randomNodes*(r: RoutingTable, count: int): seq[Node] = # insignificant compared to the time it takes for the network roundtrips when connecting # to nodes. while len(seen) < count: + # TODO: Is it important to get a better random source for these sample calls? let bucket = sample(r.buckets) if bucket.nodes.len != 0: let node = sample(bucket.nodes)