|
|
@ -310,25 +310,29 @@ defmodule Explorer.Chain.Import.Runner.Blocks do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
defp new_pending_operations(repo, nonconsensus_hashes, hashes, %{timeout: timeout, timestamps: timestamps}) do |
|
|
|
defp new_pending_operations(repo, nonconsensus_hashes, hashes, %{timeout: timeout, timestamps: timestamps}) do |
|
|
|
sorted_pending_ops = |
|
|
|
if Application.get_env(:explorer, :json_rpc_named_arguments)[:variant] == EthereumJSONRPC.RSK do |
|
|
|
nonconsensus_hashes |
|
|
|
{:ok, []} |
|
|
|
|> MapSet.new() |
|
|
|
else |
|
|
|
|> MapSet.union(MapSet.new(hashes)) |
|
|
|
sorted_pending_ops = |
|
|
|
|> Enum.sort() |
|
|
|
nonconsensus_hashes |
|
|
|
|> Enum.map(fn hash -> |
|
|
|
|> MapSet.new() |
|
|
|
%{block_hash: hash, fetch_internal_transactions: true} |
|
|
|
|> MapSet.union(MapSet.new(hashes)) |
|
|
|
end) |
|
|
|
|> Enum.sort() |
|
|
|
|
|
|
|
|> Enum.map(fn hash -> |
|
|
|
Import.insert_changes_list( |
|
|
|
%{block_hash: hash, fetch_internal_transactions: true} |
|
|
|
repo, |
|
|
|
end) |
|
|
|
sorted_pending_ops, |
|
|
|
|
|
|
|
conflict_target: :block_hash, |
|
|
|
Import.insert_changes_list( |
|
|
|
on_conflict: PendingBlockOperation.default_on_conflict(), |
|
|
|
repo, |
|
|
|
for: PendingBlockOperation, |
|
|
|
sorted_pending_ops, |
|
|
|
returning: true, |
|
|
|
conflict_target: :block_hash, |
|
|
|
timeout: timeout, |
|
|
|
on_conflict: PendingBlockOperation.default_on_conflict(), |
|
|
|
timestamps: timestamps |
|
|
|
for: PendingBlockOperation, |
|
|
|
) |
|
|
|
returning: true, |
|
|
|
|
|
|
|
timeout: timeout, |
|
|
|
|
|
|
|
timestamps: timestamps |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
defp delete_address_token_balances(_, [], _), do: {:ok, []} |
|
|
|
defp delete_address_token_balances(_, [], _), do: {:ok, []} |
|
|
|