diff --git a/apps/indexer/lib/indexer/block/realtime/consensus_ensurer.ex b/apps/indexer/lib/indexer/block/realtime/consensus_ensurer.ex deleted file mode 100644 index 816f1d76bf..0000000000 --- a/apps/indexer/lib/indexer/block/realtime/consensus_ensurer.ex +++ /dev/null @@ -1,34 +0,0 @@ -defmodule Indexer.Block.Realtime.ConsensusEnsurer do - @moduledoc """ - Triggers a refetch if a given block doesn't have consensus. - - """ - require Logger - - alias Explorer.Chain - alias Explorer.Chain.Hash - alias Indexer.Block.Realtime.Fetcher - - def perform(_, number, _) when not is_integer(number) or number < 0, do: :ok - - def perform(%Hash{byte_count: unquote(Hash.Full.byte_count())} = block_hash, number, block_fetcher) do - case Chain.hash_to_block(block_hash) do - {:ok, %{consensus: true} = _block} -> - :ignore - - _ -> - Logger.info(fn -> - [ - "refetch from consensus was found on block (", - to_string(number), - "). A reorg initiated." - ] - end) - - # trigger refetch if consensus=false or block was not found - Fetcher.fetch_and_import_block(number, block_fetcher, true) - end - - :ok - end -end diff --git a/apps/indexer/lib/indexer/block/realtime/fetcher.ex b/apps/indexer/lib/indexer/block/realtime/fetcher.ex index 49787ad675..fe486f62c2 100644 --- a/apps/indexer/lib/indexer/block/realtime/fetcher.ex +++ b/apps/indexer/lib/indexer/block/realtime/fetcher.ex @@ -27,7 +27,7 @@ defmodule Indexer.Block.Realtime.Fetcher do alias Explorer.Chain.TokenTransfer alias Explorer.Counters.AverageBlockTime alias Indexer.{AddressExtraction, Block, TokenBalances, Tracer} - alias Indexer.Block.Realtime.{ConsensusEnsurer, TaskSupervisor} + alias Indexer.Block.Realtime.TaskSupervisor alias Timex.Duration @behaviour Block.Fetcher @@ -269,12 +269,7 @@ defmodule Indexer.Block.Realtime.Fetcher do @decorate span(tracer: Tracer) defp do_fetch_and_import_block(block_number_to_fetch, block_fetcher, retry) do case fetch_and_import_range(block_fetcher, block_number_to_fetch..block_number_to_fetch) do - {:ok, %{inserted: inserted, errors: []}} -> - for block <- Map.get(inserted, :blocks, []) do - args = [block.parent_hash, block.number - 1, block_fetcher] - Task.Supervisor.start_child(TaskSupervisor, ConsensusEnsurer, :perform, args) - end - + {:ok, %{inserted: _, errors: []}} -> Logger.debug("Fetched and imported.") {:ok, %{inserted: _, errors: [_ | _] = errors}} ->