diff --git a/apps/explorer_web/lib/explorer_web/controllers/block_transaction_controller.ex b/apps/explorer_web/lib/explorer_web/controllers/block_transaction_controller.ex index 28e3fa5944..8e575aa294 100644 --- a/apps/explorer_web/lib/explorer_web/controllers/block_transaction_controller.ex +++ b/apps/explorer_web/lib/explorer_web/controllers/block_transaction_controller.ex @@ -15,7 +15,7 @@ defmodule ExplorerWeb.BlockTransactionController do necessity_by_association: %{ block: :required, from_address: :required, - to_address: :required + to_address: :optional }, pagination: params ) diff --git a/apps/explorer_web/test/explorer_web/controllers/block_transaction_controller_test.exs b/apps/explorer_web/test/explorer_web/controllers/block_transaction_controller_test.exs index a15d4bc16e..aad12fdbb7 100644 --- a/apps/explorer_web/test/explorer_web/controllers/block_transaction_controller_test.exs +++ b/apps/explorer_web/test/explorer_web/controllers/block_transaction_controller_test.exs @@ -19,14 +19,13 @@ defmodule ExplorerWeb.BlockTransactionControllerTest do test "returns transactions for the block", %{conn: conn} do block = insert(:block) - :transaction - |> insert() - |> with_block(block) + :transaction |> insert() |> with_block(block) + :transaction |> insert(to_address_hash: nil) |> with_block(block) conn = get(conn, block_transaction_path(ExplorerWeb.Endpoint, :index, :en, block.number)) assert html_response(conn, 200) - assert 1 == Enum.count(conn.assigns.page) + assert 2 == Enum.count(conn.assigns.page) end test "does not return unrelated transactions", %{conn: conn} do @@ -48,18 +47,5 @@ defmodule ExplorerWeb.BlockTransactionControllerTest do assert html_response(conn, 200) assert Enum.empty?(conn.assigns.page) end - - test "does not return related transactions without a to address", %{conn: conn} do - block = insert(:block) - - :transaction - |> insert(to_address_hash: nil) - |> with_block(block) - - conn = get(conn, block_transaction_path(ExplorerWeb.Endpoint, :index, :en, block)) - - assert html_response(conn, 200) - assert Enum.empty?(conn.assigns.page) - end end end