From c58723f641a63ae1e7eb6200a9c50e2e251131c9 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Tue, 20 Aug 2019 15:27:56 +0300 Subject: [PATCH] do not try to parse data if there is none --- .../lib/explorer/chain_spec/parity/importer.ex | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/apps/explorer/lib/explorer/chain_spec/parity/importer.ex b/apps/explorer/lib/explorer/chain_spec/parity/importer.ex index 620acfb934..8c3527d9e4 100644 --- a/apps/explorer/lib/explorer/chain_spec/parity/importer.ex +++ b/apps/explorer/lib/explorer/chain_spec/parity/importer.ex @@ -51,15 +51,23 @@ defmodule Explorer.ChainSpec.Parity.Importer do def genesis_coin_balances(chain_spec) do accounts = chain_spec["accounts"] - parse_accounts(accounts) + if accounts do + parse_accounts(accounts) + else + Logger.warn(fn -> "No accounts are defined in chain spec" end) + end end def emission_rewards(chain_spec) do rewards = chain_spec["engine"]["Ethash"]["params"]["blockReward"] - rewards - |> parse_hex_numbers() - |> format_ranges() + if rewards do + rewards + |> parse_hex_numbers() + |> format_ranges() + else + Logger.warn(fn -> "No rewards are defined in chain spec" end) + end end defp parse_accounts(accounts) do