Skip to content

Commit

Permalink
changed to getseq number
Browse files Browse the repository at this point in the history
  • Loading branch information
karasakalmt committed Jan 9, 2024
1 parent 0d26378 commit 9f1f707
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions lib/lambda_ethereum_consensus/p2p/metadata.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9f1f707

Please sign in to comment.