|
|
@ -113,8 +113,34 @@ defmodule Indexer.Address.CoinBalancesTest do |
|
|
|
|
|
|
|
|
|
|
|
params_set = CoinBalances.params_set(%{logs_params: [log_params]}) |
|
|
|
params_set = CoinBalances.params_set(%{logs_params: [log_params]}) |
|
|
|
|
|
|
|
|
|
|
|
assert MapSet.size(params_set) == 1 |
|
|
|
assert Enum.count(params_set) == 1 |
|
|
|
assert %{address_hash: address_hash, block_number: block_number} |
|
|
|
assert %{address_hash: address_hash, block_number: block_number} == List.first(params_set) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test "with log skips pending transactions" do |
|
|
|
|
|
|
|
block_number = 1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
address_hash = |
|
|
|
|
|
|
|
Factory.address_hash() |
|
|
|
|
|
|
|
|> to_string() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
log_params1 = |
|
|
|
|
|
|
|
:log |
|
|
|
|
|
|
|
|> Factory.params_for() |
|
|
|
|
|
|
|
|> Map.put(:block_number, nil) |
|
|
|
|
|
|
|
|> Map.put(:address_hash, address_hash) |
|
|
|
|
|
|
|
|> Map.put(:type, "pending") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
log_params2 = |
|
|
|
|
|
|
|
:log |
|
|
|
|
|
|
|
|> Factory.params_for() |
|
|
|
|
|
|
|
|> Map.put(:block_number, block_number) |
|
|
|
|
|
|
|
|> Map.put(:address_hash, address_hash) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
params_set = CoinBalances.params_set(%{logs_params: [log_params1, log_params2]}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert Enum.count(params_set) == 1 |
|
|
|
|
|
|
|
assert %{address_hash: address_hash, block_number: block_number} == List.first(params_set) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
test "with transaction without to_address_hash extracts from_address_hash" do |
|
|
|
test "with transaction without to_address_hash extracts from_address_hash" do |
|
|
|