Skip to content

Commit

Permalink
fix linter
Browse files Browse the repository at this point in the history
  • Loading branch information
Arkenan committed Jul 26, 2024
1 parent 47f642b commit f2ec1fc
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions lib/lambda_ethereum_consensus/fork_choice/fork_choice.ex
Original file line number Diff line number Diff line change
Expand Up @@ -230,22 +230,25 @@ defmodule LambdaEthereumConsensus.ForkChoice do

defp process_attestations(store, attestations) do
Metrics.span_operation(:attestations, nil, nil, fn ->
# prefetch states:
states =
attestations
|> Enum.map(& &1.data.target)
|> Enum.uniq()
|> Enum.flat_map(fn ch ->
case CheckpointStates.get_checkpoint_state(ch) do
{:ok, state} -> [{ch, state}]
_other -> []
end
end)
|> Map.new()
apply_handler(
attestations,
store,
&Handlers.on_attestation(&1, &2, true, prefetch_states(attestations))
)
end)
end

attestations
|> apply_handler(store, &Handlers.on_attestation(&1, &2, true, states))
defp prefetch_states(attestations) do
attestations
|> Enum.map(& &1.data.target)
|> Enum.uniq()
|> Enum.flat_map(fn ch ->
case CheckpointStates.get_checkpoint_state(ch) do
{:ok, state} -> [{ch, state}]
_other -> []
end
end)
|> Map.new()
end

@spec recompute_head(Store.t()) :: :ok
Expand Down

0 comments on commit f2ec1fc

Please sign in to comment.