From 9f1f707d1877e0fb7cd5fbfa160ceb6407fcab54 Mon Sep 17 00:00:00 2001 From: karasakalmt Date: Wed, 10 Jan 2024 01:00:35 +0300 Subject: [PATCH] changed to getseq number --- lib/lambda_ethereum_consensus/p2p/metadata.ex | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/lib/lambda_ethereum_consensus/p2p/metadata.ex b/lib/lambda_ethereum_consensus/p2p/metadata.ex index 79ce81491..06e65cec5 100644 --- a/lib/lambda_ethereum_consensus/p2p/metadata.ex +++ b/lib/lambda_ethereum_consensus/p2p/metadata.ex @@ -18,8 +18,7 @@ defmodule LambdaEthereumConsensus.P2P.Metadata do @spec get_seq_number() :: Types.uint64() def get_seq_number do - [seq_number] = get_metadata_attrs([:seq_number]) - seq_number + GenServer.call(__MODULE__, {:get_seq_number}) end @spec get_metadata() :: Metadata.t() @@ -53,9 +52,9 @@ defmodule LambdaEthereumConsensus.P2P.Metadata do end @impl true - def handle_call({:get_metadata_attrs, attrs}, _from, metadata) do - values = Enum.map(attrs, &Map.fetch!(metadata, &1)) - {:reply, values, metadata} + def handle_call({:get_seq_number, attrs}, _from, metadata) do + seq_number = Map.fetch!(metadata, :seq_number) + {:reply, seq_number, metadata} end @impl true @@ -91,11 +90,6 @@ defmodule LambdaEthereumConsensus.P2P.Metadata do ### Private Functions ########################## - @spec get_metadata_attrs([atom()]) :: [any()] - defp get_metadata_attrs(attrs) do - GenServer.call(__MODULE__, {:get_metadata_attrs, attrs}) - end - @spec set_or_clear(BitVector.t(), integer(), boolean()) :: BitVector.t() defp set_or_clear(bitvector, i, set) do if set do