Skip to content

Commit ac973e2

Browse files
committed
remove unintended diff
1 parent ff76ce5 commit ac973e2

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

lib/lambda_ethereum_consensus/p2p/peerbook.ex

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,14 @@ defmodule LambdaEthereumConsensus.P2P.Peerbook do
4141
Get some peer from the peerbook.
4242
"""
4343
def get_some_peer() do
44-
# TODO: This is a very naive implementation of a peer selection algorithm.
44+
# TODO: use some algorithm to pick a good peer, for now it's random
4545
peerbook = fetch_peerbook!()
4646

4747
if peerbook == %{} do
4848
nil
4949
else
50-
peerbook
51-
|> Enum.sort_by(fn {_peer_id, score} -> score end)
52-
|> Enum.take(4)
53-
|> Enum.random()
54-
|> elem(0)
50+
{peer_id, _score} = Enum.random(peerbook)
51+
peer_id
5552
end
5653
end
5754

0 commit comments

Comments
 (0)