Small refactoring of Indexer.Fetcher.ZkevmTxnBatch

pull/7584/head
POA 2 years ago
parent 6efe1e58c0
commit 7cf6202bc5
  1. 6
      apps/indexer/lib/indexer/fetcher/zkevm_txn_batch.ex

@ -285,7 +285,7 @@ defmodule Indexer.Fetcher.ZkevmTxnBatch do
} }
end) end)
{batches ++ [batch], l2_txs ++ l2_txs_append, l1_txs, next_id, hash_to_id} {[batch | batches], l2_txs ++ l2_txs_append, l1_txs, next_id, hash_to_id}
end) end)
{:ok, _} = {:ok, _} =
@ -323,7 +323,7 @@ defmodule Indexer.Fetcher.ZkevmTxnBatch do
defp get_tx_hash(result, type) do defp get_tx_hash(result, type) do
case Map.get(result, type) do case Map.get(result, type) do
"0x" <> tx_hash -> tx_hash "0x" <> tx_hash -> tx_hash
nil -> "0000000000000000000000000000000000000000000000000000000000000000" nil -> @zero_hash
end end
end end
@ -334,7 +334,7 @@ defmodule Indexer.Fetcher.ZkevmTxnBatch do
id = Map.get(hash_to_id, tx_hash) id = Map.get(hash_to_id, tx_hash)
if is_nil(id) do if is_nil(id) do
{next_id, l1_txs ++ [%{id: next_id, hash: tx_hash, is_verify: is_verify}], next_id + 1, {next_id, [%{id: next_id, hash: tx_hash, is_verify: is_verify} | l1_txs], next_id + 1,
Map.put(hash_to_id, tx_hash, next_id)} Map.put(hash_to_id, tx_hash, next_id)}
else else
{id, l1_txs, next_id, hash_to_id} {id, l1_txs, next_id, hash_to_id}

Loading…
Cancel
Save