|
|
@ -573,12 +573,10 @@ defmodule Explorer.Chain.Import.Runner.Blocks do |
|
|
|
initial = from(t in Transaction, where: false) |
|
|
|
initial = from(t in Transaction, where: false) |
|
|
|
|
|
|
|
|
|
|
|
Enum.reduce(blocks_changes, initial, fn %{consensus: consensus, hash: hash, number: number}, acc -> |
|
|
|
Enum.reduce(blocks_changes, initial, fn %{consensus: consensus, hash: hash, number: number}, acc -> |
|
|
|
case consensus do |
|
|
|
if consensus do |
|
|
|
false -> |
|
|
|
from(transaction in acc, or_where: transaction.block_hash != ^hash and transaction.block_number == ^number) |
|
|
|
from(transaction in acc, or_where: transaction.block_hash == ^hash and transaction.block_number == ^number) |
|
|
|
else |
|
|
|
|
|
|
|
from(transaction in acc, or_where: transaction.block_hash == ^hash and transaction.block_number == ^number) |
|
|
|
true -> |
|
|
|
|
|
|
|
from(transaction in acc, or_where: transaction.block_hash != ^hash and transaction.block_number == ^number) |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end) |
|
|
|
end) |
|
|
|
end |
|
|
|
end |
|
|
@ -587,12 +585,10 @@ defmodule Explorer.Chain.Import.Runner.Blocks do |
|
|
|
initial = from(b in Block, where: false) |
|
|
|
initial = from(b in Block, where: false) |
|
|
|
|
|
|
|
|
|
|
|
Enum.reduce(blocks_changes, initial, fn %{consensus: consensus, parent_hash: parent_hash, number: number}, acc -> |
|
|
|
Enum.reduce(blocks_changes, initial, fn %{consensus: consensus, parent_hash: parent_hash, number: number}, acc -> |
|
|
|
case consensus do |
|
|
|
if consensus do |
|
|
|
false -> |
|
|
|
from(block in acc, or_where: block.number == ^(number - 1) and block.hash != ^parent_hash) |
|
|
|
acc |
|
|
|
else |
|
|
|
|
|
|
|
acc |
|
|
|
true -> |
|
|
|
|
|
|
|
from(block in acc, or_where: block.number == ^(number - 1) and block.hash != ^parent_hash) |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end) |
|
|
|
end) |
|
|
|
end |
|
|
|
end |
|
|
|