Skip to content

Commit

Permalink
RepairWorker code_change
Browse files Browse the repository at this point in the history
  • Loading branch information
bchamagne committed Feb 16, 2024
1 parent 82e340e commit 8ac7cbb
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/archethic/self_repair/repair_worker.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ defmodule Archethic.SelfRepair.RepairWorker do
alias Archethic.SelfRepair.NotifierSupervisor

use GenServer, restart: :transient
@vsn 1
@vsn 2

require Logger

Expand Down Expand Up @@ -102,6 +102,15 @@ defmodule Archethic.SelfRepair.RepairWorker do

def handle_info(_, data), do: {:noreply, data}

# add the genesis_address to the state
def code_change(1, state, _extra) do
[genesis_address] = Registry.keys(RepairRegistry, self())
state = Map.put(state, :genesis_address, genesis_address)
{:ok, state}
end

def code_change(_version, state, _extra), do: {:ok, state}

defp start_repair(
data = %{
storage_addresses: [],
Expand Down

0 comments on commit 8ac7cbb

Please sign in to comment.