|
|
@ -9,6 +9,7 @@ defmodule Explorer.Chain.Import.Runner.InternalTransactions do |
|
|
|
alias Ecto.Adapters.SQL |
|
|
|
alias Ecto.Adapters.SQL |
|
|
|
alias Ecto.{Changeset, Multi, Repo} |
|
|
|
alias Ecto.{Changeset, Multi, Repo} |
|
|
|
alias Explorer.Chain.{Block, Hash, Import, InternalTransaction, PendingBlockOperation, Transaction} |
|
|
|
alias Explorer.Chain.{Block, Hash, Import, InternalTransaction, PendingBlockOperation, Transaction} |
|
|
|
|
|
|
|
alias Explorer.Chain.Events.Publisher |
|
|
|
alias Explorer.Chain.Import.Runner |
|
|
|
alias Explorer.Chain.Import.Runner |
|
|
|
alias Explorer.Prometheus.Instrumenter |
|
|
|
alias Explorer.Prometheus.Instrumenter |
|
|
|
alias Explorer.Repo, as: ExplorerRepo |
|
|
|
alias Explorer.Repo, as: ExplorerRepo |
|
|
@ -177,11 +178,14 @@ defmodule Explorer.Chain.Import.Runner.InternalTransactions do |
|
|
|
internal_transactions_params = Enum.filter(changes_list, &Map.has_key?(&1, :type)) |
|
|
|
internal_transactions_params = Enum.filter(changes_list, &Map.has_key?(&1, :type)) |
|
|
|
|
|
|
|
|
|
|
|
# Enforce ShareLocks tables order (see docs: sharelocks.md) |
|
|
|
# Enforce ShareLocks tables order (see docs: sharelocks.md) |
|
|
|
|
|
|
|
with {:ok, data} <- |
|
|
|
Multi.new() |
|
|
|
Multi.new() |
|
|
|
|> Multi.run(:internal_transactions, fn repo, _ -> |
|
|
|
|> Multi.run(:internal_transactions, fn repo, _ -> |
|
|
|
insert(repo, internal_transactions_params, insert_options) |
|
|
|
insert(repo, internal_transactions_params, insert_options) |
|
|
|
end) |
|
|
|
end) |
|
|
|
|> ExplorerRepo.transaction() |
|
|
|
|> ExplorerRepo.transaction() do |
|
|
|
|
|
|
|
Publisher.broadcast(data, :on_demand) |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
@impl Runner |
|
|
|
@impl Runner |
|
|
|