diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/recent_transactions_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/recent_transactions_controller.ex index a0f00df12d..a98e380e67 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/recent_transactions_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/recent_transactions_controller.ex @@ -6,32 +6,30 @@ defmodule BlockScoutWeb.RecentTransactionsController do alias Phoenix.View def index(conn, _params) do - case ajax?(conn) do - true -> - recent_transactions = - Chain.recent_collated_transactions( - necessity_by_association: %{ - :block => :required, - [created_contract_address: :names] => :optional, - [from_address: :names] => :optional, - [to_address: :names] => :optional - }, - paging_options: %PagingOptions{page_size: 5} - ) + if ajax?(conn) do + recent_transactions = + Chain.recent_collated_transactions( + necessity_by_association: %{ + :block => :required, + [created_contract_address: :names] => :optional, + [from_address: :names] => :optional, + [to_address: :names] => :optional + }, + paging_options: %PagingOptions{page_size: 5} + ) - transactions = - Enum.map(recent_transactions, fn transaction -> - %{ - transaction_hash: Hash.to_string(transaction.hash), - transaction_html: - View.render_to_string(BlockScoutWeb.TransactionView, "_tile.html", transaction: transaction) - } - end) + transactions = + Enum.map(recent_transactions, fn transaction -> + %{ + transaction_hash: Hash.to_string(transaction.hash), + transaction_html: + View.render_to_string(BlockScoutWeb.TransactionView, "_tile.html", transaction: transaction) + } + end) - json(conn, %{transactions: transactions}) - - _ -> - unprocessable_entity(conn) + json(conn, %{transactions: transactions}) + else + unprocessable_entity(conn) end end end diff --git a/apps/indexer/lib/indexer/fetcher/internal_transaction.ex b/apps/indexer/lib/indexer/fetcher/internal_transaction.ex index 754639135a..7d93bbf64f 100644 --- a/apps/indexer/lib/indexer/fetcher/internal_transaction.ex +++ b/apps/indexer/lib/indexer/fetcher/internal_transaction.ex @@ -205,15 +205,18 @@ defmodule Indexer.Fetcher.InternalTransaction do {hash, block_number} end) - case Chain.import(%{ - addresses: %{params: addresses_params}, - internal_transactions: %{params: internal_transactions_params_without_failed_creations}, - internal_transactions_indexed_at_blocks: %{ - params: internal_transactions_indexed_at_blocks, - with: :number_only_changeset - }, - timeout: :infinity - }) do + imports = + Chain.import(%{ + addresses: %{params: addresses_params}, + internal_transactions: %{params: internal_transactions_params_without_failed_creations}, + internal_transactions_indexed_at_blocks: %{ + params: internal_transactions_indexed_at_blocks, + with: :number_only_changeset + }, + timeout: :infinity + }) + + case imports do {:ok, imported} -> async_import_coin_balances(imported, %{ address_hash_to_fetched_balance_block_number: address_hash_to_block_number