Merge pull request #1590 from saneery/fix-negative-block-fetching

Added guard for fetching blocks with invalid number
pull/1597/head
Victor Baranov 6 years ago committed by GitHub
commit 2973766b6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  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 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} ->

Loading…
Cancel
Save