From b4331aaf7e2446965b21066e5a038eabd3364ddb Mon Sep 17 00:00:00 2001 From: Santiago Pittella <87827390+SantiagoPittella@users.noreply.github.com> Date: Fri, 10 Nov 2023 18:20:39 -0300 Subject: [PATCH] add missing filter for tx receipts (#364) Co-authored-by: Santiago Pittella --- lib/starknet_explorer/data.ex | 2 +- lib/starknet_explorer/transaction.ex | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/starknet_explorer/data.ex b/lib/starknet_explorer/data.ex index 9b517a44..314a2c62 100644 --- a/lib/starknet_explorer/data.ex +++ b/lib/starknet_explorer/data.ex @@ -186,7 +186,7 @@ defmodule StarknetExplorer.Data do end def transaction(tx_hash, network) do - case Transaction.get_by_hash_with_receipt(tx_hash) do + case Transaction.get_by_hash_with_receipt(tx_hash, network) do nil -> with {:ok, %{"transaction_hash" => _transaction} = tx} <- Rpc.get_transaction(tx_hash, network), diff --git a/lib/starknet_explorer/transaction.ex b/lib/starknet_explorer/transaction.ex index 1aa0b47e..827da4be 100644 --- a/lib/starknet_explorer/transaction.ex +++ b/lib/starknet_explorer/transaction.ex @@ -162,10 +162,10 @@ defmodule StarknetExplorer.Transaction do |> Repo.paginate(params) end - def get_by_hash_with_receipt(hash) do + def get_by_hash_with_receipt(hash, network) do query = from tx in Transaction, - where: tx.hash == ^hash + where: tx.hash == ^hash and tx.network == ^network case Repo.one(query) do nil ->