Merge remote-tracking branch 'upstream/master' into blocks.ether1.wattpool.net

pull/2001/head
Michael Ira Krufky 6 years ago
commit a756fd2347
  1. 4
      CHANGELOG.md
  2. 2
      apps/block_scout_web/mix.exs
  3. 19
      apps/explorer/lib/explorer/chain.ex
  4. 26
      apps/explorer/lib/explorer/counters/addresses_with_balance_counter.ex
  5. 3
      docker/Makefile
  6. 2
      mix.lock

@ -1,4 +1,5 @@
## Current
- [#2000](https://github.com/poanetwork/blockscout/pull/2000) - docker/Makefile: always set a container name
### Features
- [#1963](https://github.com/poanetwork/blockscout/pull/1963) - added rinkeby theme and rinkeby logo
@ -26,7 +27,9 @@
- [#1956](https://github.com/poanetwork/blockscout/pull/1956) - add logs tab to address
- [#1933](https://github.com/poanetwork/blockscout/pull/1933) - add eth_BlockNumber json rpc method
- [#1952](https://github.com/poanetwork/blockscout/pull/1952) - feat: exclude empty contracts by default
- [#1989](https://github.com/poanetwork/blockscout/pull/1989) - fix: consolidate address w/ balance one at a time
- [#1954](https://github.com/poanetwork/blockscout/pull/1954) - feat: use creation init on self destruct
- [#2002](https://github.com/poanetwork/blockscout/pull/2002) - Get estimated count of blocks when cache is empty
### Fixes
@ -51,6 +54,7 @@
- [#1937](https://github.com/poanetwork/blockscout/pull/1937) - Check the presence of overlap[i] object before retrieving properties from it
- [#1960](https://github.com/poanetwork/blockscout/pull/1960) - do not remove bold text in decompiled contacts
- [#1917](https://github.com/poanetwork/blockscout/pull/1917) - Force block refetch if transaction is re-collated in a different block
- [#1992](https://github.com/poanetwork/blockscout/pull/1992) - fix: support https for wobserver polling
### Chore

@ -128,7 +128,7 @@ defmodule BlockScoutWeb.Mixfile do
{:timex, "~> 3.4"},
{:wallaby, "~> 0.22", only: [:test], runtime: false},
# `:cowboy` `~> 2.0` and Phoenix 1.4 compatibility
{:wobserver, "~> 0.2.0", github: "KronicDeth/wobserver", ref: "99683a936c75c0a94ebb884cef019f7ed0b97112"},
{:wobserver, "~> 0.2.0", github: "poanetwork/wobserver", branch: "support-https"},
{:phoenix_form_awesomplete, "~> 0.1.4"}
]
end

@ -363,21 +363,6 @@ defmodule Explorer.Chain do
Repo.aggregate(Block, :count, :hash)
end
@doc """
The number of consensus blocks.
iex> insert(:block, consensus: true)
iex> insert(:block, consensus: false)
iex> Explorer.Chain.block_consensus_count()
1
"""
def block_consensus_count do
Block
|> where(consensus: true)
|> Repo.aggregate(:count, :hash)
end
@doc """
Reward for mining a block.
@ -1997,7 +1982,9 @@ defmodule Explorer.Chain do
cached_value = BlockCountCache.count()
if is_nil(cached_value) do
block_consensus_count()
%Postgrex.Result{rows: [[count]]} = Repo.query!("SELECT reltuples FROM pg_class WHERE relname = 'blocks';")
trunc(count * 0.90)
else
cached_value
end

@ -40,15 +40,10 @@ defmodule Explorer.Counters.AddressesWithBalanceCounter do
end
@impl true
def init(args) do
def init(_args) do
create_table()
if enable_consolidation?() do
Task.start_link(&consolidate/0)
schedule_next_consolidation()
end
{:ok, args}
{:ok, %{consolidate?: enable_consolidation?()}, {:continue, :ok}}
end
def create_table do
@ -63,9 +58,7 @@ defmodule Explorer.Counters.AddressesWithBalanceCounter do
end
defp schedule_next_consolidation do
if enable_consolidation?() do
Process.send_after(self(), :consolidate, :timer.seconds(@update_interval_in_seconds))
end
Process.send_after(self(), :consolidate, :timer.seconds(@update_interval_in_seconds))
end
@doc """
@ -75,6 +68,19 @@ defmodule Explorer.Counters.AddressesWithBalanceCounter do
:ets.insert(table_name(), {key, info})
end
@impl true
def handle_continue(:ok, %{consolidate?: true} = state) do
consolidate()
schedule_next_consolidation()
{:noreply, state}
end
@impl true
def handle_continue(:ok, state) do
{:noreply, state}
end
@impl true
def handle_info(:consolidate, state) do
consolidate()

@ -1,6 +1,7 @@
SYSTEM = $(shell uname -s)
HOST = host.docker.internal
DOCKER_IMAGE = blockscout_prod
BS_CONTAINER_NAME = blockscout
PG_CONTAINER_NAME = postgres
PG_CONTAINER_IMAGE = postgres:10.4
THIS_FILE = $(lastword $(MAKEFILE_LIST))
@ -87,7 +88,7 @@ endif
start: build postgres
@echo "==> Starting blockscout"
@docker run --rm \
@docker run --rm --name $(BS_CONTAINER_NAME) \
$(BLOCKSCOUT_CONTAINNER_PARAMS) \
-p 4000:4000 \
$(DOCKER_IMAGE) /bin/sh -c "mix phx.server"

@ -109,5 +109,5 @@
"unicode_util_compat": {:hex, :unicode_util_compat, "0.4.1", "d869e4c68901dd9531385bb0c8c40444ebf624e60b6962d95952775cac5e90cd", [:rebar3], [], "hexpm"},
"wallaby": {:hex, :wallaby, "0.22.0", "e5d16bfa7ab23562c8a6e3b0a31445a2fd470ca622082a910114807ba823780d", [:mix], [{:httpoison, "~> 0.12 or ~> 1.0", [hex: :httpoison, repo: "hexpm", optional: false]}, {:poison, ">= 1.4.0", [hex: :poison, repo: "hexpm", optional: false]}, {:poolboy, "~> 1.5", [hex: :poolboy, repo: "hexpm", optional: false]}], "hexpm"},
"websocket_client": {:hex, :websocket_client, "1.3.0", "2275d7daaa1cdacebf2068891c9844b15f4fdc3de3ec2602420c2fb486db59b6", [:rebar3], [], "hexpm"},
"wobserver": {:git, "https://github.com/KronicDeth/wobserver.git", "99683a936c75c0a94ebb884cef019f7ed0b97112", [ref: "99683a936c75c0a94ebb884cef019f7ed0b97112"]},
"wobserver": {:git, "https://github.com/poanetwork/wobserver.git", "13bcda30a87f4f0be1878920a79433ad831eefbe", [branch: "support-https"]},
}

Loading…
Cancel
Save