|
|
@ -98,9 +98,10 @@ defmodule Indexer.Fetcher.InternalTransaction do |
|
|
|
) |
|
|
|
) |
|
|
|
def run(block_numbers, json_rpc_named_arguments) do |
|
|
|
def run(block_numbers, json_rpc_named_arguments) do |
|
|
|
unique_numbers = Enum.uniq(block_numbers) |
|
|
|
unique_numbers = Enum.uniq(block_numbers) |
|
|
|
|
|
|
|
filtered_unique_numbers = EthereumJSONRPC.block_numbers_in_range(unique_numbers) |
|
|
|
|
|
|
|
|
|
|
|
unique_numbers_count = Enum.count(unique_numbers) |
|
|
|
filtered_unique_numbers_count = Enum.count(filtered_unique_numbers) |
|
|
|
Logger.metadata(count: unique_numbers_count) |
|
|
|
Logger.metadata(count: filtered_unique_numbers_count) |
|
|
|
|
|
|
|
|
|
|
|
Logger.debug("fetching internal transactions for blocks") |
|
|
|
Logger.debug("fetching internal transactions for blocks") |
|
|
|
|
|
|
|
|
|
|
@ -108,14 +109,14 @@ defmodule Indexer.Fetcher.InternalTransaction do |
|
|
|
|> Keyword.fetch!(:variant) |
|
|
|
|> Keyword.fetch!(:variant) |
|
|
|
|> case do |
|
|
|
|> case do |
|
|
|
EthereumJSONRPC.Parity -> |
|
|
|
EthereumJSONRPC.Parity -> |
|
|
|
EthereumJSONRPC.fetch_block_internal_transactions(unique_numbers, json_rpc_named_arguments) |
|
|
|
EthereumJSONRPC.fetch_block_internal_transactions(filtered_unique_numbers, json_rpc_named_arguments) |
|
|
|
|
|
|
|
|
|
|
|
EthereumJSONRPC.Besu -> |
|
|
|
EthereumJSONRPC.Besu -> |
|
|
|
EthereumJSONRPC.fetch_block_internal_transactions(unique_numbers, json_rpc_named_arguments) |
|
|
|
EthereumJSONRPC.fetch_block_internal_transactions(filtered_unique_numbers, json_rpc_named_arguments) |
|
|
|
|
|
|
|
|
|
|
|
_ -> |
|
|
|
_ -> |
|
|
|
try do |
|
|
|
try do |
|
|
|
fetch_block_internal_transactions_by_transactions(unique_numbers, json_rpc_named_arguments) |
|
|
|
fetch_block_internal_transactions_by_transactions(filtered_unique_numbers, json_rpc_named_arguments) |
|
|
|
rescue |
|
|
|
rescue |
|
|
|
error -> |
|
|
|
error -> |
|
|
|
{:error, error} |
|
|
|
{:error, error} |
|
|
@ -123,15 +124,15 @@ defmodule Indexer.Fetcher.InternalTransaction do |
|
|
|
end |
|
|
|
end |
|
|
|
|> case do |
|
|
|
|> case do |
|
|
|
{:ok, internal_transactions_params} -> |
|
|
|
{:ok, internal_transactions_params} -> |
|
|
|
import_internal_transaction(internal_transactions_params, unique_numbers) |
|
|
|
import_internal_transaction(internal_transactions_params, filtered_unique_numbers) |
|
|
|
|
|
|
|
|
|
|
|
{:error, reason} -> |
|
|
|
{:error, reason} -> |
|
|
|
Logger.error(fn -> ["failed to fetch internal transactions for blocks: ", inspect(reason)] end, |
|
|
|
Logger.error(fn -> ["failed to fetch internal transactions for blocks: ", inspect(reason)] end, |
|
|
|
error_count: unique_numbers_count |
|
|
|
error_count: filtered_unique_numbers_count |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
# re-queue the de-duped entries |
|
|
|
# re-queue the de-duped entries |
|
|
|
{:retry, unique_numbers} |
|
|
|
{:retry, filtered_unique_numbers} |
|
|
|
|
|
|
|
|
|
|
|
:ignore -> |
|
|
|
:ignore -> |
|
|
|
:ok |
|
|
|
:ok |
|
|
|