Add fallback for Explorer.Staking.ContractState.latest_block

staking
Vadim 5 years ago committed by Victor Baranov
parent 839b0d2016
commit ad11c3793e
  1. 2
      apps/explorer/lib/explorer/staking/contract_state.ex

@ -115,7 +115,7 @@ defmodule Explorer.Staking.ContractState do
@doc "Handles new blocks and decides to fetch fresh chain info"
def handle_info({:chain_event, :blocks, :realtime, blocks}, state) do
latest_block = Enum.max_by(blocks, & &1.number)
latest_block = Enum.max_by(blocks, & &1.number, fn -> %{number: 0} end)
if latest_block.number > state.seen_block do
fetch_state(state.contracts, state.abi, latest_block.number)

Loading…
Cancel
Save