Merge pull request #1768 from poanetwork/ab-fix-first-block-parameter

fix first block parameter
pull/1770/head
Ayrat Badykov 6 years ago committed by GitHub
commit e37fd929eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 2
      apps/indexer/config/config.exs
  3. 11
      apps/indexer/lib/indexer/block/catchup/fetcher.ex

@ -13,6 +13,7 @@
- [#1740](https://github.com/poanetwork/blockscout/pull/1740) - fix empty block time
- [#1743](https://github.com/poanetwork/blockscout/pull/1743) - sort decompiled smart contracts in lexicographical order
- [#1756](https://github.com/poanetwork/blockscout/pull/1756) - add today's token balance from the previous value
- [#1768](https://github.com/poanetwork/blockscout/pull/1768) - fix first block parameter
- [#1778](https://github.com/poanetwork/blockscout/pull/1778) - Make websocket optional for realtime fetcher
### Chore

@ -34,7 +34,7 @@ config :indexer,
metadata_updater_days_interval: 2,
# bytes
memory_limit: 1 <<< 30,
first_block: System.get_env("FIRST_BLOCK") || 0
first_block: System.get_env("FIRST_BLOCK") || "0"
# config :indexer, Indexer.Fetcher.ReplacedTransaction.Supervisor, disabled?: true
# config :indexer, Indexer.Fetcher.BlockReward.Supervisor, disabled?: true

@ -82,7 +82,7 @@ defmodule Indexer.Block.Catchup.Fetcher do
_ ->
# realtime indexer gets the current latest block
first = latest_block_number - 1
last = Application.get_env(:indexer, :first_block)
last = last_block()
Logger.metadata(first_block_number: first, last_block_number: last)
@ -328,4 +328,13 @@ defmodule Indexer.Block.Catchup.Fetcher do
{:error, :queue_unavailable}
end
end
defp last_block do
string_value = Application.get_env(:indexer, :first_block)
case Integer.parse(string_value) do
{integer, ""} -> integer
_ -> 0
end
end
end

Loading…
Cancel
Save