pull/3440/head
Victor Baranov 4 years ago
parent 15ffd1c996
commit b8e184f838
  1. 15
      apps/explorer/lib/explorer/chain.ex

@ -2447,6 +2447,21 @@ defmodule Explorer.Chain do
iex> Explorer.Chain.missing_block_number_ranges(2..0) iex> Explorer.Chain.missing_block_number_ranges(2..0)
[1..1] [1..1]
if range starts with non-consensus block in the middle of the chain, it returns missing numbers.
iex> insert(:block, number: 12859383, consensus: true)
iex> insert(:block, number: 12859384, consensus: false)
iex> insert(:block, number: 12859386, consensus: true)
iex> Explorer.Chain.missing_block_number_ranges(12859384..12859385)
[12859384..12859385]
if range starts with missing block in the middle of the chain, it returns missing numbers.
iex> insert(:block, number: 12859383, consensus: true)
iex> insert(:block, number: 12859386, consensus: true)
iex> Explorer.Chain.missing_block_number_ranges(12859384..12859385)
[12859384..12859385]
""" """
@spec missing_block_number_ranges(Range.t()) :: [Range.t()] @spec missing_block_number_ranges(Range.t()) :: [Range.t()]
def missing_block_number_ranges(range) def missing_block_number_ranges(range)

Loading…
Cancel
Save