Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix fetch_last_token_balance function termination #5019

Merged
merged 1 commit into from
Dec 19, 2021

Conversation

vbaranov
Copy link
Member

@vbaranov vbaranov commented Dec 19, 2021

Resolves #4934

Motivation

Fixing an error of kind:

2021-12-14T21:04:16.957 [error] GenServer #PID<0.735.406> terminating
** (Ecto.Query.CastError) apps/explorer/lib/explorer/chain/address/current_token_balance.ex:191: value `%{}` in `where` cannot be cast to type Explorer.Chain.Hash.Address in query:

from c0 in Explorer.Chain.Address.CurrentTokenBalance,
  where: c0.token_contract_address_hash == ^%Explorer.Chain.Hash{byte_count: 20, bytes: <<183, 211, 17, 226, 235, 85, 242, 246, 138, 148, 64, 218, 56, 231, 152, 146, 16, 185, 160, 94>>},
  where: c0.address_hash == ^%{},
  select: c0.value

    (elixir 1.12.2) lib/enum.ex:2385: Enum."-reduce/3-lists^foldl/2-0-"/3
    (elixir 1.12.2) lib/enum.ex:1704: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
    (elixir 1.12.2) lib/enum.ex:1704: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3

Checklist for your Pull Request (PR)

@vbaranov vbaranov force-pushed the vb-fetch_last_token_balance-error-fix branch from e1de1d9 to 6a22ffa Compare December 19, 2021 19:24
@vbaranov vbaranov force-pushed the vb-fetch_last_token_balance-error-fix branch from 6a22ffa to 74872b8 Compare December 19, 2021 19:27
@vbaranov vbaranov merged commit 33d636d into master Dec 19, 2021
@vbaranov vbaranov deleted the vb-fetch_last_token_balance-error-fix branch December 19, 2021 20:11
sidhujag pushed a commit to syscoin/blockscout that referenced this pull request Dec 20, 2021
…n_balance-error-fix

Fix fetch_last_token_balance function termination
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

current_token_balance: cast to type Explorer.Chain.Hash.Address in query
1 participant