Skip to content

Commit

Permalink
Remove obsolete code_change
Browse files Browse the repository at this point in the history
  • Loading branch information
Neylix committed Jun 21, 2023
1 parent f934684 commit 1e1edfc
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 32 deletions.
15 changes: 0 additions & 15 deletions lib/archethic/p2p/mem_table.ex
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,6 @@ defmodule Archethic.P2P.MemTable do
{:ok, []}
end

def code_change("1.1.1", state, _extra) do
# This match_spec remove the key :"$9" which is the availability_history
match_spec = [
{{:"$1", :"$2", :"$3", :"$4", :"$5", :"$6", :"$7", :"$8", :"$9", :"$10", :"$11", :"$12",
:"$13", :"$14", :"$15", :"$16", :"$17", :"$18"}, [],
[
{{:"$1", :"$2", :"$3", :"$4", :"$5", :"$6", :"$7", :"$8", :"$10", :"$11", :"$12", :"$13",
:"$14", :"$15", :"$16", :"$17", :"$18"}}
]}
]

:ets.select_replace(@discovery_table, match_spec)
{:ok, state}
end

@doc """
Add a node into the P2P view.
Expand Down
17 changes: 0 additions & 17 deletions test/archethic/p2p/mem_table_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,4 @@ defmodule Archethic.P2P.MemTableTest do
alias Archethic.P2P.Node

doctest MemTable

test "code_change" do
values =
{"key1", "key2", {127, 0, 0, 1}, 3000, 4000, "AFZ", "AAA", 0.9, <<1::1, 1::1>>,
~U[2020-10-22 23:19:45.797109Z], :tcp, "reward_address", "last_address", "origin_key",
true, ~U[2020-10-22 23:19:45.797109Z], true, ~U[2020-10-22 23:19:45.797109Z]}

:ets.insert(:archethic_node_discovery, values)
assert {:ok, %{}} = MemTable.code_change("1.1.1", %{}, nil)

assert [
{"key1", "key2", {127, 0, 0, 1}, 3000, 4000, "AFZ", "AAA", 0.9,
~U[2020-10-22 23:19:45.797109Z], :tcp, "reward_address", "last_address",
"origin_key", true, ~U[2020-10-22 23:19:45.797109Z], true,
~U[2020-10-22 23:19:45.797109Z]}
] = :ets.lookup(:archethic_node_discovery, "key1")
end
end

0 comments on commit 1e1edfc

Please sign in to comment.