Skip to content

Commit

Permalink
Remove 1.5.9 migration function
Browse files Browse the repository at this point in the history
  • Loading branch information
Neylix committed Oct 8, 2024
1 parent 572ad96 commit 9d7d4e6
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 50 deletions.
18 changes: 0 additions & 18 deletions lib/archethic/crypto/keystore/node/software_impl.ex
Original file line number Diff line number Diff line change
Expand Up @@ -230,22 +230,4 @@ defmodule Archethic.Crypto.NodeKeystore.SoftwareImpl do
store_node_key_indexes(index)
{:reply, :ok, state}
end

@impl GenServer
# FIXME: use genserver message because ets table is protected
def handle_call(:migrate_1_5_9, _from, state) do
node_seed = Origin.retrieve_node_seed()
:ets.insert(@keystore_table, {:node_seed, node_seed})
:ets.delete(@keystore_table, :sign_fun)
:ets.delete(@keystore_table, :public_key_fun)
:ets.delete(@keystore_table, :dh_fun)

{:reply, :ok, state}
end

# FIXME: to remove after 1.5.9
@doc false
def migrate_ets_table_1_5_9 do
GenServer.call(__MODULE__, :migrate_1_5_9)
end
end
16 changes: 0 additions & 16 deletions lib/archethic/crypto/keystore/shared_secrets/software_impl.ex
Original file line number Diff line number Diff line change
Expand Up @@ -269,20 +269,4 @@ defmodule Archethic.Crypto.SharedSecretsKeystore.SoftwareImpl do

@impl GenServer
def code_change(_old_vsn, state, _extra), do: {:ok, state}

# FIXME: to remove after 1.5.9
@doc false
def migrate_ets_table_1_5_9 do
:node_shared_secrets
|> TransactionChain.list_addresses_by_type()
|> Stream.take(-2)
|> Enum.each(&load_node_shared_secrets_tx/1)

:ets.delete(@keystore_table, :transaction_sign_fun)
:ets.delete(@keystore_table, :reward_sign_fun)
:ets.delete(@keystore_table, :transaction_public_key_fun)
:ets.delete(@keystore_table, :reward_public_key_fun)
:ets.delete(@keystore_table, :transaction_seed_wrap_fun)
:ets.delete(@keystore_table, :reward_seed_wrap_fun)
end
end
16 changes: 0 additions & 16 deletions lib/archethic/p2p/mem_table.ex
Original file line number Diff line number Diff line change
Expand Up @@ -487,20 +487,4 @@ defmodule Archethic.P2P.MemTable do
:ok
end
end

# FIXME: to remove after 1.5.9
@doc false
def migrate_ets_table_1_5_9 do
# Inject the mining public key as nil awaiting the migration scripts to be executed
ms = [
{{:"$1", :"$2", :"$3", :"$4", :"$5", :"$6", :"$7", :"$8", :"$9", :"$10", :"$11", :"$12",
:"$13", :"$14", :"$15", :"$16", :"$17"}, [],
[
{{:"$1", :"$2", :"$3", :"$4", :"$5", :"$6", :"$7", :"$8", :"$9", :"$10", :"$11", :"$12",
:"$13", :"$14", :"$15", :"$16", :"$17", nil}}
]}
]

:ets.select_replace(@discovery_table, ms)
end
end

0 comments on commit 9d7d4e6

Please sign in to comment.