Skip to content

Commit

Permalink
Fix summary_cache code change
Browse files Browse the repository at this point in the history
  • Loading branch information
Neylix committed Jun 8, 2023
1 parent 6c68963 commit cbe3319
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 19 deletions.
16 changes: 0 additions & 16 deletions lib/archethic/beacon_chain/subset/summary_cache.ex
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,6 @@ defmodule Archethic.BeaconChain.Subset.SummaryCache do
def code_change("1.0.7", state, _extra) do
PubSub.register_to_current_epoch_of_slot_time()

Enum.each(BeaconChain.list_subsets(), fn subset ->
:ets.take(@table_name, subset)
|> Enum.each(fn
{subset, {slot, pub_key}} ->
backup_slot(slot, pub_key)
:ets.insert(@table_name, {subset, slot})

{subset, slot} ->
slot = Slot.transform("1.1.0", slot)
backup_slot(slot, "")
:ets.insert(@table_name, {subset, slot})
end)
end)

Utils.mut_dir("slot_backup") |> File.rm()

{:ok, state}
end

Expand Down
9 changes: 8 additions & 1 deletion lib/archethic/transaction_chain/transaction_summary.ex
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,14 @@ defmodule Archethic.TransactionChain.TransactionSummary do
_ ->
nodes = Election.chain_storage_nodes(address, P2P.authorized_and_available_nodes())
# I don't know what to do if fetching transaction fail so I let it crash
{:ok, tx} = TransactionChain.fetch_transaction_remotely(address, nodes)
acceptance_resolver = fn
{:ok, %Transaction{address: ^address}} -> true
_ -> false
end

{:ok, tx} =
TransactionChain.fetch_transaction_remotely(address, nodes, 0, acceptance_resolver)

tx
end

Expand Down
3 changes: 1 addition & 2 deletions rel/appups/archethic/1.0.7_to_1.1.0.appup
Original file line number Diff line number Diff line change
Expand Up @@ -1051,8 +1051,7 @@
[[{keys, unique}, {name, 'Elixir.Archethic.RunExclusiveRegistry'}]]},
type => supervisor
}
]}},
{apply,{'Elixir.Mix.Tasks.Archethic.Migrate',run,["1.1.0",true]}}]}],
]}}]}],
[{"1.0.7",
[{delete_module,'Elixir.Archethic.BeaconChain.NetworkCoordinates'},
{delete_module,'Elixir.Archethic.BeaconChain.Subset.StatsCollector'},
Expand Down

0 comments on commit cbe3319

Please sign in to comment.