Skip to content

Commit

Permalink
Remove obsolete ConsensusEnsurer
Browse files Browse the repository at this point in the history
As a result of #1657 out-of-place parent blocks are marked as non-consensus
more reliably, i.e. they will eventually be fetched even if first attempt is
unsuccessful.

The `ConsensusEnsurer` module, on the contrary, only tried refetching block
once, and left it as-is if the refetch failed. Now it is not needed anymore.
  • Loading branch information
goodsoft committed Apr 2, 2019
1 parent bc61808 commit 9dbf51d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 41 deletions.
34 changes: 0 additions & 34 deletions apps/indexer/lib/indexer/block/realtime/consensus_ensurer.ex

This file was deleted.

9 changes: 2 additions & 7 deletions apps/indexer/lib/indexer/block/realtime/fetcher.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}} ->
Expand Down

0 comments on commit 9dbf51d

Please sign in to comment.