From 158720ea2059448b24c7e4f4fc987aa59fe6750a Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Fri, 19 Jul 2024 18:38:12 +0300 Subject: [PATCH] fix: Missing clauses in MetadataPreloader functions (#10439) * Missing clause in MetadataPreloader.alter_address * Update clause for alter_address * Add nil clause for item_to_address_hash_strings --- .../lib/explorer/chain/address/metadata_preloader.ex | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/apps/explorer/lib/explorer/chain/address/metadata_preloader.ex b/apps/explorer/lib/explorer/chain/address/metadata_preloader.ex index 762af23c3f..2ee81f2843 100644 --- a/apps/explorer/lib/explorer/chain/address/metadata_preloader.ex +++ b/apps/explorer/lib/explorer/chain/address/metadata_preloader.ex @@ -127,6 +127,8 @@ defmodule Explorer.Chain.Address.MetadataPreloader do end) end + defp item_to_address_hash_strings(nil), do: [] + defp item_to_address_hash_strings(%Transaction{ to_address_hash: to_address_hash, created_contract_address_hash: created_contract_address_hash, @@ -285,14 +287,16 @@ defmodule Explorer.Chain.Address.MetadataPreloader do alter_address(address, address.hash, names, field_to_put_info) end - defp alter_address(_, nil, _names, _field) do - nil - end + defp alter_address(address, nil, _names, _field), do: address defp alter_address(%NotLoaded{}, address_hash, names, field) do %{field => names[Address.checksum(address_hash)]} end + defp alter_address(nil, address_hash, names, field) do + %{field => names[Address.checksum(address_hash)]} + end + defp alter_address(%Address{} = address, address_hash, names, :ens_domain_name) do %Address{address | ens_domain_name: names[Address.checksum(address_hash)]} end