diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/receipt.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/receipt.ex index 69975bf08f..0649d5ad0c 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/receipt.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/receipt.ex @@ -266,6 +266,7 @@ defmodule EthereumJSONRPC.Receipt do defp elixir_reducer({:ok, {_, _}}, {:error, _reasons} = acc_error), do: acc_error defp elixir_reducer({:error, reason}, {:ok, _}), do: {:error, [reason]} defp elixir_reducer({:error, reason}, {:error, reasons}), do: {:error, [reason | reasons]} + defp elixir_reducer(:ignore, acc), do: acc defp ok!({:ok, elixir}, _receipt), do: elixir @@ -327,6 +328,8 @@ defmodule EthereumJSONRPC.Receipt do case status do "0x0" -> {:ok, {key, :error}} "0x1" -> {:ok, {key, :ok}} + # pre-Byzantium / Ethereum Classic on Parity + nil -> :ignore other -> {:error, {:unknown_value, %{key: key, value: other}}} end end diff --git a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/receipt_test.exs b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/receipt_test.exs index 60e80282d5..b54b2ae984 100644 --- a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/receipt_test.exs +++ b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/receipt_test.exs @@ -43,5 +43,10 @@ defmodule EthereumJSONRPC.ReceiptTest do }) end end + + # Regression test for https://github.com/poanetwork/blockscout/issues/638 + test ~s|"status" => nil is treated the same as no status| do + assert Receipt.to_elixir(%{"status" => nil, "transactionHash" => "0x0"}) == %{"transactionHash" => "0x0"} + end end end