Added guard for check block number before fetch it

pull/1590/head
saneery 6 years ago
parent 807f7c32cb
commit 5c2e2f2309
  1. 2
      apps/indexer/lib/indexer/block/realtime/consensus_ensurer.ex

@ -9,6 +9,8 @@ defmodule Indexer.Block.Realtime.ConsensusEnsurer do
alias Explorer.Chain.Hash alias Explorer.Chain.Hash
alias Indexer.Block.Realtime.Fetcher 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 def perform(%Hash{byte_count: unquote(Hash.Full.byte_count())} = block_hash, number, block_fetcher) do
case Chain.hash_to_block(block_hash) do case Chain.hash_to_block(block_hash) do
{:ok, %{consensus: true} = _block} -> {:ok, %{consensus: true} = _block} ->

Loading…
Cancel
Save