Merge pull request #7638 from blockscout/revert-7598-fix-created-contract-address-hash-detection

Revert "Fix created_contract_address_hash detection"
pull/7639/head
Victor Baranov 1 year ago committed by GitHub
commit 6ee7c267a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 14
      apps/explorer/lib/explorer/chain/import/runner/internal_transactions.ex

@ -26,7 +26,6 @@
- [#7545](https://github.com/blockscout/blockscout/pull/7545) - API v2: Check if cached exchange rate is empty before replacing DB value in stats API
- [#7516](https://github.com/blockscout/blockscout/pull/7516) - Fix shrinking logo in Safari
- [#7590](https://github.com/blockscout/blockscout/pull/7590) - Drop genesis block in internal transactions fetcher
- [#7598](https://github.com/blockscout/blockscout/pull/7598) - Fix created_contract_address_hash detection
### Chore

@ -427,28 +427,18 @@ defmodule Explorer.Chain.Import.Runner.InternalTransactions do
if valid_internal_transactions_count == 0 do
{:ok, nil}
else
created_contract_address_hash_map =
valid_internal_transactions
|> Enum.group_by(& &1.transaction_hash)
|> Enum.map(fn {transaction_hash, internal_transactions} ->
{transaction_hash, Enum.find_value(internal_transactions, & &1[:created_contract_address_hash])}
end)
|> Enum.into(%{})
params =
valid_internal_transactions
|> Enum.filter(fn internal_tx ->
internal_tx[:index] == 0
end)
|> Enum.map(fn trace ->
transaction_hash = Map.get(trace, :transaction_hash)
%{
block_hash: Map.get(trace, :block_hash),
block_number: Map.get(trace, :block_number),
gas_used: Map.get(trace, :gas_used),
transaction_hash: transaction_hash,
created_contract_address_hash: created_contract_address_hash_map[transaction_hash],
transaction_hash: Map.get(trace, :transaction_hash),
created_contract_address_hash: Map.get(trace, :created_contract_address_hash),
error: Map.get(trace, :error),
status: if(is_nil(Map.get(trace, :error)), do: :ok, else: :error)
}

Loading…
Cancel
Save