handle_get_block_by_number -> handle_get_block

`handle_get_block_by_number` handles the result from both
`fetch_blocks_by_number` AND `fetch_blocks_by_number`, so it isn't
handling just the `_by_number` result and is a misnomer.
pull/248/head
Luke Imhoff 7 years ago
parent ff1b95fa2e
commit 240be361b8
  1. 8
      apps/ethereum_jsonrpc/lib/ethereum_jsonrpc.ex

@ -139,7 +139,7 @@ defmodule EthereumJSONRPC do
batched_requests batched_requests
|> json_rpc(config(:url)) |> json_rpc(config(:url))
|> handle_get_block_by_number() |> handle_get_block()
|> case do |> case do
{:ok, _next, results} -> {:ok, results} {:ok, _next, results} -> {:ok, results}
{:error, reason} -> {:error, reason} {:error, reason} -> {:error, reason}
@ -153,7 +153,7 @@ defmodule EthereumJSONRPC do
block_start block_start
|> build_batch_get_block_by_number(block_end) |> build_batch_get_block_by_number(block_end)
|> json_rpc(config(:url)) |> json_rpc(config(:url))
|> handle_get_block_by_number() |> handle_get_block()
end end
@doc """ @doc """
@ -260,7 +260,7 @@ defmodule EthereumJSONRPC do
raise("bad jason") raise("bad jason")
end end
defp handle_get_block_by_number({:ok, results}) do defp handle_get_block({:ok, results}) do
{blocks, next} = {blocks, next} =
Enum.reduce(results, {[], :more}, fn Enum.reduce(results, {[], :more}, fn
%{"result" => nil}, {blocks, _} -> {blocks, :end_of_chain} %{"result" => nil}, {blocks, _} -> {blocks, :end_of_chain}
@ -279,7 +279,7 @@ defmodule EthereumJSONRPC do
}} }}
end end
defp handle_get_block_by_number({:error, reason}) do defp handle_get_block({:error, reason}) do
{:error, reason} {:error, reason}
end end

Loading…
Cancel
Save