Skip to content

Commit

Permalink
Merge pull request blockscout#4993 from blockscout/vb-fix-address_to_…
Browse files Browse the repository at this point in the history
…gas_usage_count

address_to_gas_usage_count function fix for nil incoming transactions gas usage count
  • Loading branch information
vbaranov authored and jagdeep sidhu committed Dec 8, 2021
1 parent 02bfc75 commit b01160b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- [#4931](https://github.com/blockscout/blockscout/pull/4931) - Web3 modal with Wallet Connect for Write contract page and Staking Dapp

### Fixes
- [#4979](https://github.com/blockscout/blockscout/pull/4979) - Store total gas_used in addresses table
- [#4979](https://github.com/blockscout/blockscout/pull/4979), [#4993](https://github.com/blockscout/blockscout/pull/4993) - Store total gas_used in addresses table
- [#4977](https://github.com/blockscout/blockscout/pull/4977) - Export token transfers on address: include transfers on contract itself
- [#4976](https://github.com/blockscout/blockscout/pull/4976) - Handle :econnrefused in pending transactions fetcher
- [#4965](https://github.com/blockscout/blockscout/pull/4965) - Fix search field appearance on medium size screens
Expand Down
13 changes: 9 additions & 4 deletions apps/explorer/lib/explorer/chain.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2548,10 +2548,15 @@ defmodule Explorer.Chain do
if contract?(address) do
incoming_transaction_gas_usage = address_to_incoming_transaction_gas_usage(address.hash)

if Decimal.cmp(incoming_transaction_gas_usage, 0) == :eq do
address_to_outcoming_transaction_gas_usage(address.hash)
else
incoming_transaction_gas_usage
cond do
!incoming_transaction_gas_usage ->
address_to_outcoming_transaction_gas_usage(address.hash)

Decimal.cmp(incoming_transaction_gas_usage, 0) == :eq ->
address_to_outcoming_transaction_gas_usage(address.hash)

true ->
incoming_transaction_gas_usage
end
else
address_to_outcoming_transaction_gas_usage(address.hash)
Expand Down

0 comments on commit b01160b

Please sign in to comment.