Skip to content

Commit c48aa5a

Browse files
committed
Remove thing in db
1 parent 4de36a8 commit c48aa5a

2 files changed

Lines changed: 3 additions & 17 deletions

File tree

lib/archethic/db/embedded_impl/chain_reader.ex

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -550,17 +550,7 @@ defmodule Archethic.DB.EmbeddedImpl.ChainReader do
550550
end
551551
end
552552
)
553-
|> then(fn tx ->
554-
# To avoid atomize manfiest keys we need to extract and inject it later
555-
{contract, tx} =
556-
get_and_update_in(tx, [Access.key(:data, %{}), :contract], fn contract ->
557-
{contract, nil}
558-
end)
559-
560-
tx
561-
|> Utils.atomize_keys()
562-
|> put_in([:data, :contract], contract)
563-
end)
553+
|> Utils.atomize_keys()
564554
|> Transaction.cast()
565555
end
566556
end

lib/archethic/utils.ex

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,7 @@ defmodule Archethic.Utils do
276276
atomize_keys(map, nest_dot?, to_snake_case?)
277277
end
278278

279-
def atomize_keys(struct = %{__struct__: _}, _, _) do
280-
struct
281-
end
279+
def atomize_keys(map, _, _) when is_struct(map), do: map
282280

283281
def atomize_keys(map = %{}, nest_dot?, to_snake_case?) do
284282
map
@@ -320,9 +318,7 @@ defmodule Archethic.Utils do
320318
atomize_keys(rest, nest_dot?, to_snake_case?)
321319
end
322320

323-
def atomize_keys(not_a_map, _, _) do
324-
not_a_map
325-
end
321+
def atomize_keys(not_a_map, _, _), do: not_a_map
326322

327323
defp nested_path(_keys, acc \\ [])
328324

0 commit comments

Comments
 (0)