Skip to content

Commit

Permalink
add order to fetching pending blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
DenSmolonski committed Jun 18, 2024
1 parent c7d1962 commit ec88138
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
21 changes: 18 additions & 3 deletions apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/geth.ex
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ defmodule EthereumJSONRPC.Geth do
@impl EthereumJSONRPC.Variant
def fetch_internal_transactions(transactions_params, json_rpc_named_arguments) when is_list(transactions_params) do
id_to_params = id_to_params(transactions_params)

json_rpc_named_arguments_corrected_timeout = correct_timeouts(json_rpc_named_arguments)

with {:ok, responses} <-
Expand Down Expand Up @@ -149,11 +148,27 @@ defmodule EthereumJSONRPC.Geth do
debug_trace_transaction_timeout =
Application.get_env(:ethereum_jsonrpc, __MODULE__)[:debug_trace_transaction_timeout]

request(%{
request_params = %{
id: id,
method: "debug_traceTransaction",
params: [hash_data, %{timeout: debug_trace_transaction_timeout} |> Map.merge(tracer_params())]
})
}

try do
request(request_params)
catch
kind, reason ->
IO.inspect(request_params)

# Optionally, re-raise the error if you want the caller to handle it
{:error, reason}
end

# request(%{
# id: id,
# method: "debug_traceTransaction",
# params: [hash_data, %{timeout: debug_trace_transaction_timeout} |> Map.merge(tracer_params())]
# })
end

defp debug_trace_block_by_number_request({id, block_number}) do
Expand Down
3 changes: 2 additions & 1 deletion apps/explorer/lib/explorer/chain.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1952,7 +1952,8 @@ defmodule Explorer.Chain do
from(
po in PendingBlockOperation,
where: not is_nil(po.block_number),
select: po.block_number
select: po.block_number,
order_by: [desc: po.block_number]
)

query
Expand Down
2 changes: 1 addition & 1 deletion apps/indexer/lib/indexer/fetcher/internal_transaction.ex
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ defmodule Indexer.Fetcher.InternalTransaction do
end,
error_count: filtered_unique_numbers_count
)
IO.inspect('FAIL:', filtered_unique_numbers)
IO.inspect(filtered_unique_numbers)
handle_not_found_transaction(reason)

# re-queue the de-duped entries
Expand Down

0 comments on commit ec88138

Please sign in to comment.