Skip to content

Commit

Permalink
fix: Add function clause for wrong first trace result format (blocksc…
Browse files Browse the repository at this point in the history
  • Loading branch information
Qwerty5Uiop authored Jan 15, 2025
1 parent 471bf71 commit 83ffe3c
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,26 @@ defmodule EthereumJSONRPC.TraceReplayBlockTransactions do
{:error, annotated_error}
end

defp trace_replay_transaction_response_to_first_trace(%{id: id, result: error_result}, id_to_params)
when is_map(id_to_params) do
%{
block_hash: block_hash,
block_number: block_number,
hash_data: transaction_hash,
transaction_index: transaction_index
} = Map.fetch!(id_to_params, id)

annotated_error = %{
"blockHash" => block_hash,
"blockNumber" => block_number,
"transactionIndex" => transaction_index,
"transactionHash" => transaction_hash,
"result" => error_result
}

{:error, annotated_error}
end

defp trace_replay_transaction_requests(id_to_params) when is_map(id_to_params) do
Enum.map(id_to_params, fn {id, %{hash_data: hash_data}} ->
trace_replay_transaction_request(%{id: id, hash_data: hash_data})
Expand Down

0 comments on commit 83ffe3c

Please sign in to comment.