fix more Nethermind errors

pull/2196/head
Ayrat Badykov 6 years ago
parent e580792b40
commit b594c3c8af
No known key found for this signature in database
GPG Key ID: B44668E265E9396F
  1. 7
      apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/block.ex
  2. 10
      apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/http.ex
  3. 3
      apps/indexer/lib/indexer/transform/blocks.ex

@ -75,13 +75,6 @@ defmodule EthereumJSONRPC.Block do
end
def from_response(%{id: id, result: block}, id_to_params) when is_map(id_to_params) do
id =
if is_binary(id) do
quantity_to_integer(id)
else
id
end
true = Map.has_key?(id_to_params, id)
{:ok, block}

@ -7,6 +7,8 @@ defmodule EthereumJSONRPC.HTTP do
require Logger
import EthereumJSONRPC, only: [quantity_to_integer: 1]
@behaviour Transport
@doc """
@ -131,6 +133,14 @@ defmodule EthereumJSONRPC.HTTP do
# restrict response to only those fields supported by the JSON-RPC 2.0 standard, which means that level of keys is
# validated, so we can indicate that with switch to atom keys.
defp standardize_response(%{"jsonrpc" => "2.0" = jsonrpc, "id" => id} = unstandardized) do
# Nethermind return string ids
id =
if is_binary(id) do
quantity_to_integer(id)
else
id
end
standardized = %{jsonrpc: jsonrpc, id: id}
case unstandardized do

@ -65,6 +65,9 @@ defmodule Indexer.Transform.Blocks do
decode(rest)
end
# specific to Nethermind
defp decode("0"), do: 0
defp decode(data) do
Base.decode16!(data, case: :mixed)
end

Loading…
Cancel
Save