Skip to content

Commit

Permalink
get internal State child chain height without exposing new api
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotr Dobaczewski Imapp committed Aug 24, 2018
1 parent 7108713 commit 9cd6624
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
5 changes: 0 additions & 5 deletions apps/omg_watcher/lib/block_getter.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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}}}
Expand Down
4 changes: 3 additions & 1 deletion apps/omg_watcher/test/support/integration/test_helper.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9cd6624

Please sign in to comment.