diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/receipt.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/receipt.ex index c050776801..0a20f4ba5d 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/receipt.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/receipt.ex @@ -258,7 +258,14 @@ defmodule EthereumJSONRPC.Receipt do defp entry_to_elixir({key, quantity}) when key in ~w(blockNumber cumulativeGasUsed gasUsed transactionIndex) do - {:ok, {key, quantity_to_integer(quantity)}} + result = + if is_nil(quantity) do + nil + else + quantity_to_integer(quantity) + end + + {:ok, {key, result}} end defp entry_to_elixir({"logs" = key, logs}) do diff --git a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/receipt_test.exs b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/receipt_test.exs index 38f5fa7a7a..b5ee4ae2ef 100644 --- a/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/receipt_test.exs +++ b/apps/ethereum_jsonrpc/test/ethereum_jsonrpc/receipt_test.exs @@ -30,4 +30,11 @@ defmodule EthereumJSONRPC.ReceiptTest do assert Receipt.to_elixir(%{"status" => nil, "transactionHash" => "0x0"}) == %{"transactionHash" => "0x0"} end end + + test "leaves nil if blockNumber is nil" do + assert Receipt.to_elixir(%{"blockNumber" => nil, "transactionHash" => "0x0"}) == %{ + "transactionHash" => "0x0", + "blockNumber" => nil + } + end end diff --git a/apps/indexer/lib/indexer/block/realtime/consensus_ensurer.ex b/apps/indexer/lib/indexer/block/realtime/consensus_ensurer.ex index a49a826a6b..363f54fbed 100644 --- a/apps/indexer/lib/indexer/block/realtime/consensus_ensurer.ex +++ b/apps/indexer/lib/indexer/block/realtime/consensus_ensurer.ex @@ -3,6 +3,7 @@ defmodule Indexer.Block.Realtime.ConsensusEnsurer do Triggers a refetch if a given block doesn't have consensus. """ + require Logger alias Explorer.Chain alias Explorer.Chain.Hash @@ -14,6 +15,14 @@ defmodule Indexer.Block.Realtime.ConsensusEnsurer do :ignore _ -> + Logger.info(fn -> + [ + "refetch from consensus was found on block (", + to_string(number), + "). A reorg initiated." + ] + end) + # trigger refetch if consensus=false or block was not found Fetcher.fetch_and_import_block(number, block_fetcher, true) end diff --git a/docker/Dockerfile b/docker/Dockerfile index 9c1a4809e2..a29c69baf4 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,6 +1,6 @@ -FROM bitwalker/alpine-elixir-phoenix:latest +FROM bitwalker/alpine-elixir-phoenix:1.7.1 -RUN apk --no-cache --update add automake libtool inotify-tools autoconf +RUN apk --no-cache --update add automake libtool inotify-tools autoconf python EXPOSE 4000 @@ -19,6 +19,9 @@ RUN mix do deps.get, deps.compile ADD . . +ARG COIN +RUN if [ "$COIN" != "" ]; then sed -i s/"POA"/"${COIN}"/g apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po; fi + # Run forderground build and phoenix digest RUN mix compile diff --git a/docker/Makefile b/docker/Makefile index e280a753e5..1f49ff50b5 100644 --- a/docker/Makefile +++ b/docker/Makefile @@ -53,7 +53,7 @@ ifdef HAS_BLOCKSCOUT_IMAGE @echo "==> Image exist. Using $(DOCKER_IMAGE)" else @echo "==> No image found trying to build one..." - @docker build -f ./Dockerfile -t $(DOCKER_IMAGE) ../ + @docker build --build-arg COIN="$(COIN)" -f ./Dockerfile -t $(DOCKER_IMAGE) ../ endif migrate: build postgres