Skip to content

Commit

Permalink
Add code_change for subset
Browse files Browse the repository at this point in the history
  • Loading branch information
Neylix committed Mar 15, 2023
1 parent 6ec156d commit 43b8dce
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/archethic/beacon_chain/subset.ex
Original file line number Diff line number Diff line change
Expand Up @@ -411,4 +411,20 @@ defmodule Archethic.BeaconChain.Subset do
end

defp ensure_p2p_view(slot = %Slot{}, _), do: slot

def code_change(
"1.0.7",
state = %{postponed: %{transaction_attestations: postponed_attestations}},
_extra
) do
new_state =
Enum.reduce(postponed_attestations, state, fn attestation, acc ->
Map.update!(acc, :current_slot, &Slot.add_transaction_attestation(&1, attestation))
end)
|> Map.delete(:postponed)

{:ok, new_state}
end

def code_change(_, state, _), do: {:ok, state}
end

0 comments on commit 43b8dce

Please sign in to comment.