From 9cd6624316bfa4b01d31e7e4ca205b34dc1b507a Mon Sep 17 00:00:00 2001 From: Piotr Dobaczewski Imapp Date: Fri, 24 Aug 2018 16:31:57 +0200 Subject: [PATCH] get internal State child chain height without exposing new api --- apps/omg_watcher/lib/block_getter.ex | 5 ----- apps/omg_watcher/test/support/integration/test_helper.ex | 4 +++- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/apps/omg_watcher/lib/block_getter.ex b/apps/omg_watcher/lib/block_getter.ex index a650808b6e..104c667a92 100644 --- a/apps/omg_watcher/lib/block_getter.ex +++ b/apps/omg_watcher/lib/block_getter.ex @@ -97,11 +97,6 @@ defmodule OMG.Watcher.BlockGetter do } end - # TODO get_height used in tests instead of an event system, remove when event system is here - def handle_call(:get_height, _from, state) do - {:reply, state.last_consumed_block, state} - end - @spec handle_info( :producer | {reference(), {:got_block, {:ok, map}}} diff --git a/apps/omg_watcher/test/support/integration/test_helper.ex b/apps/omg_watcher/test/support/integration/test_helper.ex index 8e6a728f97..e57f45592b 100644 --- a/apps/omg_watcher/test/support/integration/test_helper.ex +++ b/apps/omg_watcher/test/support/integration/test_helper.ex @@ -17,6 +17,7 @@ defmodule OMG.Watcher.Integration.TestHelper do Common helper functions that are useful when integration-testing the watcher """ + alias OMG.API.State alias OMG.Eth import OMG.Watcher.TestHelper @@ -48,8 +49,9 @@ defmodule OMG.Watcher.Integration.TestHelper do end defp wait_for_block(block_nr) do + # TODO query to State used in tests instead of an event system, remove when event system is here fn -> - case GenServer.call(OMG.Watcher.BlockGetter, :get_height) < block_nr do + case State.get_current_child_block_height() <= block_nr do true -> :repeat false -> {:ok, block_nr} end