diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/block.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/block.ex index b2f3a87fcd..116232f999 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/block.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/block.ex @@ -435,10 +435,15 @@ defmodule EthereumJSONRPC.Block do end defp entry_to_elixir({key, quantity}) - when key in ~w(difficulty gasLimit gasUsed minimumGasPrice number size totalDifficulty) do + when key in ~w(difficulty gasLimit gasUsed minimumGasPrice number size totalDifficulty) and not is_nil(quantity) do {key, quantity_to_integer(quantity)} end + # Size may be `nil` for uncle blocks + defp entry_to_elixir({key, nil}) when key in ~w(size) do + {key, nil} + end + # double check that no new keys are being missed by requiring explicit match for passthrough # `t:EthereumJSONRPC.address/0` and `t:EthereumJSONRPC.hash/0` pass through as `Explorer.Chain` can verify correct # hash format