diff --git a/CHANGELOG.md b/CHANGELOG.md index ccab710c40..ff56c5ad7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ - [#2130](https://github.com/poanetwork/blockscout/pull/2130) - fix navigation - [#2147](https://github.com/poanetwork/blockscout/pull/2147) - add rsk format of checksum - [#2149](https://github.com/poanetwork/blockscout/pull/2149) - remove pending transaction count +- [#2173](https://github.com/poanetwork/blockscout/pull/2173) - handle correctly empty transactions - [#2174](https://github.com/poanetwork/blockscout/pull/2174) - fix reward channel joining - [#2186](https://github.com/poanetwork/blockscout/pull/2186) - fix net version test diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/block.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/block.ex index 6be34eeee1..1c52a6e6c9 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/block.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/block.ex @@ -319,6 +319,8 @@ defmodule EthereumJSONRPC.Block do @spec elixir_to_transactions(elixir) :: Transactions.elixir() def elixir_to_transactions(%{"transactions" => transactions}), do: transactions + def elixir_to_transactions(_), do: [] + @doc """ Get `t:EthereumJSONRPC.Uncles.elixir/0` from `t:elixir/0`. diff --git a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/block_test.exs b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/block_test.exs index 1cf16c6f47..23e1e442c5 100644 --- a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/block_test.exs +++ b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/block_test.exs @@ -56,4 +56,10 @@ defmodule EthereumJSONRPC.BlockTest do } end end + + describe "elixir_to_transactions/1" do + test "converts to empty list if there is not transaction key" do + assert Block.elixir_to_transactions(%{}) == [] + end + end end