Merge pull request #3401 from poanetwork/vb-fix-int-txs-status

Fix procedure of marking internal transactions as failed
pull/3403/head
Victor Baranov 4 years ago committed by GitHub
commit 797b190d01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 1
      apps/explorer/lib/explorer/chain.ex
  3. 21
      apps/indexer/lib/indexer/fetcher/internal_transaction.ex

@ -12,6 +12,7 @@
### Fixes ### Fixes
- [#3401](https://github.com/poanetwork/blockscout/pull/3401) - Fix procedure of marking internal transactions as failed
- [#3399](https://github.com/poanetwork/blockscout/pull/3399) - Fix Token transfers CSV export - [#3399](https://github.com/poanetwork/blockscout/pull/3399) - Fix Token transfers CSV export
- [#3396](https://github.com/poanetwork/blockscout/pull/3396) - Handle exchange rates request throttled - [#3396](https://github.com/poanetwork/blockscout/pull/3396) - Handle exchange rates request throttled
- [#3382](https://github.com/poanetwork/blockscout/pull/3382) - Check ets table exists for know tokens - [#3382](https://github.com/poanetwork/blockscout/pull/3382) - Check ets table exists for know tokens

@ -1554,6 +1554,7 @@ defmodule Explorer.Chain do
iex> for index <- 5..9 do iex> for index <- 5..9 do
...> insert(:block, number: index) ...> insert(:block, number: index)
...> Process.sleep(200)
...> end ...> end
iex> Explorer.Chain.indexed_ratio() iex> Explorer.Chain.indexed_ratio()
Decimal.new(1, 50, -2) Decimal.new(1, 50, -2)

@ -239,27 +239,26 @@ defmodule Indexer.Fetcher.InternalTransaction do
defp remove_failed_creations(internal_transactions_params) do defp remove_failed_creations(internal_transactions_params) do
internal_transactions_params internal_transactions_params
|> Enum.map(fn internal_transaction_params -> |> Enum.map(fn internal_transaction_param ->
internal_transaction_params[:trace_address] transaction_index = internal_transaction_param[:transaction_index]
failed_parent_index = failed_parent =
Enum.find(internal_transaction_params[:trace_address], fn trace_address -> internal_transactions_params
parent = Enum.at(internal_transactions_params, trace_address) |> Enum.filter(fn internal_transactions_param ->
internal_transactions_param[:transaction_index] == transaction_index &&
!is_nil(parent[:error]) internal_transactions_param[:trace_address] == [] && !is_nil(internal_transactions_param[:error])
end) end)
|> Enum.at(0)
failed_parent = failed_parent_index && Enum.at(internal_transactions_params, failed_parent_index)
if failed_parent do if failed_parent do
internal_transaction_params internal_transaction_param
|> Map.delete(:created_contract_address_hash) |> Map.delete(:created_contract_address_hash)
|> Map.delete(:created_contract_code) |> Map.delete(:created_contract_code)
|> Map.delete(:gas_used) |> Map.delete(:gas_used)
|> Map.delete(:output) |> Map.delete(:output)
|> Map.put(:error, failed_parent[:error]) |> Map.put(:error, failed_parent[:error])
else else
internal_transaction_params internal_transaction_param
end end
end) end)
end end

Loading…
Cancel
Save