Include block number when ordering token balances

The block number matters for ordering as a token can be updated for an
address multiple times across different blocks in one insert.
pull/1296/head
Luke Imhoff 6 years ago
parent 6165f6757f
commit b69d437b06
  1. 3
      apps/explorer/lib/explorer/chain/import/runner/address/token_balances.ex

@ -60,7 +60,8 @@ defmodule Explorer.Chain.Import.Runner.Address.TokenBalances do
on_conflict = Map.get_lazy(options, :on_conflict, &default_on_conflict/0)
# order so that row ShareLocks are grabbed in a consistent order
ordered_changes_list = Enum.sort_by(changes_list, &{&1.address_hash, &1.block_number})
ordered_changes_list =
Enum.sort_by(changes_list, &{&1.address_hash, &1.token_contract_address_hash, &1.block_number})
{:ok, _} =
Import.insert_changes_list(

Loading…
Cancel
Save