Skip to content

Commit

Permalink
fix: credo checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Valentin Atanasov authored and yaboiishere committed Apr 23, 2024
1 parent d50d48b commit 8d52c87
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
13 changes: 10 additions & 3 deletions lib/ae_mdw_web/websocket/broadcaster.ex
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,14 @@ defmodule AeMdwWeb.Websocket.Broadcaster do
@impl GenServer
def init(%{state: state}), do: {:ok, %{internal_state: state}}

@spec broadcast_key_block(Db.key_block(), version(), source(), count(), count()) :: :ok
@spec broadcast_key_block(
GenServer.server(),
Db.key_block(),
version(),
source(),
count(),
count()
) :: :ok
def broadcast_key_block(name \\ __MODULE__, block, version, source, mb_count, txs_count) do
header = :aec_blocks.to_header(block)
{:ok, hash} = :aec_headers.hash_header(header)
Expand All @@ -54,7 +61,7 @@ defmodule AeMdwWeb.Websocket.Broadcaster do
:ok
end

@spec broadcast_micro_block(Db.micro_block(), source()) :: :ok
@spec broadcast_micro_block(GenServer.server(), Db.micro_block(), source()) :: :ok
def broadcast_micro_block(name \\ __MODULE__, block, source) do
header = :aec_blocks.to_header(block)
{:ok, hash} = :aec_headers.hash_header(header)
Expand All @@ -73,7 +80,7 @@ defmodule AeMdwWeb.Websocket.Broadcaster do
:ok
end

@spec broadcast_txs(Db.micro_block(), source()) :: :ok
@spec broadcast_txs(GenServer.server(), Db.micro_block(), source()) :: :ok
def broadcast_txs(name \\ __MODULE__, block, source) do
{:ok, hash} = block |> :aec_blocks.to_header() |> :aec_headers.hash_header()

Expand Down
4 changes: 2 additions & 2 deletions test/support/blockchain_sim.ex
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,10 @@ defmodule AeMdwWeb.BlockchainSim do
find_tx_location: fn tx_hash ->
micro_block =
Enum.find_value(mock_blocks, fn
{_name, {:mic_block, _, txs, _} = micro_block} ->
{_name, {:mic_block, _header, txs, _pof} = micro_block} ->
Enum.any?(txs, fn tx -> :aetx_sign.hash(tx) == tx_hash end) && micro_block

_ ->
_another_type_of_block ->
false
end)

Expand Down

0 comments on commit 8d52c87

Please sign in to comment.