From 585c410d90b69e3f8ce64fbb30f22c6ea25deccc Mon Sep 17 00:00:00 2001 From: Jacek Sieka Date: Mon, 10 Aug 2020 10:22:52 +0200 Subject: [PATCH] remove randompeers unused, requires importing `random` which we're trying to avoid --- beacon_chain/eth2_network.nim | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/beacon_chain/eth2_network.nim b/beacon_chain/eth2_network.nim index a83df60bf..577f86d7b 100644 --- a/beacon_chain/eth2_network.nim +++ b/beacon_chain/eth2_network.nim @@ -1,6 +1,6 @@ import # Std lib - std/[typetraits, strutils, os, random, algorithm, sequtils, math, sets], + std/[typetraits, strutils, os, algorithm, sequtils, math, sets], std/options as stdOptions, # Status libs @@ -1247,13 +1247,3 @@ proc broadcast*(node: Eth2Node, topic: string, msg: auto) = data = snappy.encode(SSZ.encode(msg)) var futSnappy = node.switch.publish(topic & "_snappy", data, 1.minutes) traceMessage(futSnappy, gossipId(data)) - -# TODO: -# At the moment, this is just a compatiblity shim for the existing RLPx functionality. -# The filtering is not implemented properly yet. -iterator randomPeers*(node: Eth2Node, maxPeers: int, Protocol: type): Peer = - var peers = newSeq[Peer]() - for _, peer in pairs(node.peers): peers.add peer - shuffle peers - if peers.len > maxPeers: peers.setLen(maxPeers) - for p in peers: yield p