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. 23
      apps/indexer/lib/indexer/fetcher/internal_transaction.ex

@ -12,6 +12,7 @@
### 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
- [#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

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

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

Loading…
Cancel
Save