Merge branch 'master' into ab-do-not-fetch-burn-address-balance

pull/1614/head
Victor Baranov 6 years ago committed by GitHub
commit 3eb6b8b3ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      CHANGELOG.md
  2. 66
      apps/indexer/lib/indexer/temporary/addresses_without_code.ex

@ -7,6 +7,21 @@
### Chore
## 1.3.7-beta
### Features
### Fixes
- [#1615](https://github.com/poanetwork/blockscout/pull/1615) - Add more logging to code fixer process
- [#1613](https://github.com/poanetwork/blockscout/pull/1613) - Fix USD fee value
- [#1577](https://github.com/poanetwork/blockscout/pull/1577) - Add process to fix contract with code
- [#1583](https://github.com/poanetwork/blockscout/pull/1583) - Chunk JSON-RPC batches in case connection times out
### Chore
- [#1610](https://github.com/poanetwork/blockscout/pull/1610) - Add PIRL to Readme
## 1.3.6-beta
### Features

@ -45,6 +45,13 @@ defmodule Indexer.Temporary.AddressesWithoutCode do
end
def fix_transaction_without_to_address_and_created_contract_address(fetcher) do
Logger.debug(
[
"Started fix_transaction_without_to_address_and_created_contract_address"
],
fetcher: :addresses_without_code
)
query =
from(block in Block,
left_join: transaction in Transaction,
@ -56,23 +63,23 @@ defmodule Indexer.Temporary.AddressesWithoutCode do
)
process_query(query, fetcher)
end
defp process_query(query, fetcher) do
query_stream = Repo.stream(query, max_rows: @batch_size)
stream =
TaskSupervisor
|> Task.Supervisor.async_stream_nolink(
query_stream,
fn block -> refetch_block(block, fetcher) end,
@task_options
Logger.debug(
[
"Started fix_transaction_without_to_address_and_created_contract_address"
],
fetcher: :addresses_without_code
)
Repo.transaction(fn -> Stream.run(stream) end)
end
def fix_addresses_with_creation_transaction_but_without_code(fetcher) do
Logger.debug(
[
"Started fix_addresses_with_creation_transaction_but_without_code"
],
fetcher: :addresses_without_code
)
second_query =
from(block in Block,
left_join: transaction in Transaction,
@ -87,10 +94,45 @@ defmodule Indexer.Temporary.AddressesWithoutCode do
)
process_query(second_query, fetcher)
Logger.debug(
[
"Finished fix_addresses_with_creation_transaction_but_without_code"
],
fetcher: :addresses_without_code
)
end
defp process_query(query, fetcher) do
query_stream = Repo.stream(query, max_rows: @batch_size)
stream =
TaskSupervisor
|> Task.Supervisor.async_stream_nolink(
query_stream,
fn block -> refetch_block(block, fetcher) end,
@task_options
)
Repo.transaction(fn -> Stream.run(stream) end)
end
def refetch_block(block, fetcher) do
Logger.debug(
[
"Processing block #{to_string(block.hash)} #{block.number}"
],
fetcher: :addresses_without_code
)
Fetcher.fetch_and_import_block(block.number, fetcher, false)
Logger.debug(
[
"Finished processing block #{to_string(block.hash)} #{block.number}"
],
fetcher: :addresses_without_code
)
rescue
e ->
Logger.debug(

Loading…
Cancel
Save