diff --git a/apps/explorer/lib/explorer/chain/import.ex b/apps/explorer/lib/explorer/chain/import.ex index 470a93851a..c9be328246 100644 --- a/apps/explorer/lib/explorer/chain/import.ex +++ b/apps/explorer/lib/explorer/chain/import.ex @@ -1047,7 +1047,7 @@ defmodule Explorer.Chain.Import do ] ) - {sql, parameters} = SQL.to_sql(:all, Repo, query) + {sql, parameters} = SQL.to_sql(:all, Repo, query) |> IO.inspect() {:ok, %Postgrex.Result{columns: ["uncle_hash", "hash"], command: :insert, rows: rows}} = SQL.query( diff --git a/apps/explorer/test/explorer/chain/import_test.exs b/apps/explorer/test/explorer/chain/import_test.exs index 59145714cd..0bf54ffa4f 100644 --- a/apps/explorer/test/explorer/chain/import_test.exs +++ b/apps/explorer/test/explorer/chain/import_test.exs @@ -1629,5 +1629,17 @@ defmodule Explorer.Chain.ImportTest do assert DateTime.compare(timestamp, timestamp_before) == :eq end + + # https://github.com/poanetwork/blockscout/issues/850 regression test + test "derive_transaction_forks returns errors" do + _pending_transaction = insert(:transaction) + + {:error, :derive_transaction_forks, %Postgrex.Error{postgres: %{code: :not_null_violation, column: "index"}}, _} = + Import.all(%{ + blocks: %{ + params: [] + } + }) + end end end