diff --git a/apps/block_scout_web/lib/block_scout_web/views/transaction_view.ex b/apps/block_scout_web/lib/block_scout_web/views/transaction_view.ex index 955f7e097420..aec0593a71b9 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/transaction_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/transaction_view.ex @@ -505,7 +505,9 @@ defmodule BlockScoutWeb.TransactionView do token = Transaction.get_fee_token_name(transaction) case token do - {:ok, address} -> address + {:ok, address} -> + address + {:error, :not_found} -> Logger.info("Found unknown gas token at #{inspect(gch)}") ChainToken.set_uncatalogued_token(transaction) diff --git a/apps/explorer/lib/explorer/chain/import/runner/address/token_balances.ex b/apps/explorer/lib/explorer/chain/import/runner/address/token_balances.ex index a61e35882330..a6573b857c2d 100644 --- a/apps/explorer/lib/explorer/chain/import/runner/address/token_balances.ex +++ b/apps/explorer/lib/explorer/chain/import/runner/address/token_balances.ex @@ -95,7 +95,7 @@ defmodule Explorer.Chain.Import.Runner.Address.TokenBalances do {:unsafe_fragment, ~s<(address_hash, token_contract_address_hash, COALESCE(token_id, -1), block_number)>}, on_conflict: on_conflict, for: TokenBalance, - returning: false + returning: false, timeout: timeout, timestamps: timestamps ) diff --git a/apps/explorer/lib/explorer/chain/token.ex b/apps/explorer/lib/explorer/chain/token.ex index dbcbbbf557a8..b05c12ae6248 100644 --- a/apps/explorer/lib/explorer/chain/token.ex +++ b/apps/explorer/lib/explorer/chain/token.ex @@ -143,6 +143,7 @@ defmodule Explorer.Chain.Token do end def set_uncatalogued_token(%{gas_currency_hash: nil}), do: :ok + def set_uncatalogued_token(%{gas_currency_hash: address}) do %Token{} |> changeset(%{contract_address_hash: address, type: "ERC-20"}) diff --git a/apps/explorer/priv/repo/migrations/20240207100347_recommended_tx_index.exs b/apps/explorer/priv/repo/migrations/20240207100347_recommended_tx_index.exs new file mode 100644 index 000000000000..6c785cc7644d --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20240207100347_recommended_tx_index.exs @@ -0,0 +1,17 @@ +defmodule Explorer.Repo.Local.Migrations.RecommendedTxIndex do + use Ecto.Migration + + def change do + create_if_not_exists( + index( + :transactions, + [ + :block_hash, + :hash + ], + name: "transactions_block_hash_hash", + concurrently: true + ) + ) + end +end