From ac973e242389eea7cf4daa6244771880d29f55e1 Mon Sep 17 00:00:00 2001 From: Rodrigo Oliveri Date: Wed, 2 Oct 2024 16:16:25 -0300 Subject: [PATCH] remove unintended diff --- lib/lambda_ethereum_consensus/p2p/peerbook.ex | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/lambda_ethereum_consensus/p2p/peerbook.ex b/lib/lambda_ethereum_consensus/p2p/peerbook.ex index e5b21fca8..96b9c34a9 100644 --- a/lib/lambda_ethereum_consensus/p2p/peerbook.ex +++ b/lib/lambda_ethereum_consensus/p2p/peerbook.ex @@ -41,17 +41,14 @@ defmodule LambdaEthereumConsensus.P2P.Peerbook do Get some peer from the peerbook. """ def get_some_peer() do - # TODO: This is a very naive implementation of a peer selection algorithm. + # TODO: use some algorithm to pick a good peer, for now it's random peerbook = fetch_peerbook!() if peerbook == %{} do nil else - peerbook - |> Enum.sort_by(fn {_peer_id, score} -> score end) - |> Enum.take(4) - |> Enum.random() - |> elem(0) + {peer_id, _score} = Enum.random(peerbook) + peer_id end end