Skip to content

Commit

Permalink
Remove thing in db
Browse files Browse the repository at this point in the history
  • Loading branch information
Neylix committed Dec 31, 2024
1 parent 4de36a8 commit c48aa5a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
12 changes: 1 addition & 11 deletions lib/archethic/db/embedded_impl/chain_reader.ex
Original file line number Diff line number Diff line change
Expand Up @@ -550,17 +550,7 @@ defmodule Archethic.DB.EmbeddedImpl.ChainReader do
end
end
)
|> then(fn tx ->
# To avoid atomize manfiest keys we need to extract and inject it later
{contract, tx} =
get_and_update_in(tx, [Access.key(:data, %{}), :contract], fn contract ->
{contract, nil}
end)

tx
|> Utils.atomize_keys()
|> put_in([:data, :contract], contract)
end)
|> Utils.atomize_keys()
|> Transaction.cast()
end
end
8 changes: 2 additions & 6 deletions lib/archethic/utils.ex
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,7 @@ defmodule Archethic.Utils do
atomize_keys(map, nest_dot?, to_snake_case?)
end

def atomize_keys(struct = %{__struct__: _}, _, _) do
struct
end
def atomize_keys(map, _, _) when is_struct(map), do: map

def atomize_keys(map = %{}, nest_dot?, to_snake_case?) do
map
Expand Down Expand Up @@ -320,9 +318,7 @@ defmodule Archethic.Utils do
atomize_keys(rest, nest_dot?, to_snake_case?)
end

def atomize_keys(not_a_map, _, _) do
not_a_map
end
def atomize_keys(not_a_map, _, _), do: not_a_map

defp nested_path(_keys, acc \\ [])

Expand Down

0 comments on commit c48aa5a

Please sign in to comment.