Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigo-o committed Oct 14, 2024
1 parent 96681a5 commit 8faf7d6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
7 changes: 4 additions & 3 deletions lib/lambda_ethereum_consensus/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ defmodule LambdaEthereumConsensus.Application do
end

defp get_children(:db) do
get_children(:mixed) ++ [
{Task.Supervisor, name: StoreStatesSupervisor}
]
get_children(:mixed) ++
[
{Task.Supervisor, name: StoreStatesSupervisor}
]
end

defp get_children(:full) do
Expand Down
15 changes: 11 additions & 4 deletions lib/libp2p_port.ex
Original file line number Diff line number Diff line change
Expand Up @@ -798,16 +798,23 @@ defmodule LambdaEthereumConsensus.Libp2pPort do
|> update_syncing_status(new_slot_data, new_store)
end

defp update_syncing_status(%{syncing: false} = state, {slot, _third}, %Types.Store{head_slot: head_slot})
when slot - head_slot >= @head_drift_alert do
defp update_syncing_status(%{syncing: false} = state, {slot, _third}, %Types.Store{
head_slot: head_slot
})
when slot - head_slot >= @head_drift_alert do
Logger.error("[Libp2p] Head slot drifted by #{slot - head_slot} slots.")

# TODO: (#1194) The node is not yet ready to resync but this allows to avoid spamming errors after a drift.
%{state | syncing: true}
end

defp update_syncing_status(%{syncing: true, blocks_remaining: 0} = state, {slot, _third}, %Types.Store{head_slot: head_slot})
when slot - head_slot == 0, do: %{state | syncing: false}
defp update_syncing_status(
%{syncing: true, blocks_remaining: 0} = state,
{slot, _third},
%Types.Store{head_slot: head_slot}
)
when slot - head_slot == 0,
do: %{state | syncing: false}

defp update_syncing_status(state, _slot_data, _), do: state

Expand Down

0 comments on commit 8faf7d6

Please sign in to comment.