From 9f9b181fa23f352d536ae3698eaea6ab80b2d5bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mois=C3=A9s=20Fern=C3=A1ndez?= <7888669+moisses89@users.noreply.github.com> Date: Fri, 28 Jul 2023 14:54:37 +0200 Subject: [PATCH] Add address to query filter condition (#1594) --- safe_transaction_service/history/models.py | 5 ++++- safe_transaction_service/history/tests/test_models.py | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/safe_transaction_service/history/models.py b/safe_transaction_service/history/models.py index 73d53d416..21900847c 100644 --- a/safe_transaction_service/history/models.py +++ b/safe_transaction_service/history/models.py @@ -1306,7 +1306,10 @@ def with_confirmations_required(self): :return: queryset with `confirmations_required: int` field """ threshold_safe_status_query = ( - SafeStatus.objects.filter(internal_tx__ethereum_tx=OuterRef("ethereum_tx")) + SafeStatus.objects.filter( + address=OuterRef("safe"), + internal_tx__ethereum_tx=OuterRef("ethereum_tx"), + ) .sorted_reverse_by_mined() .values("threshold") ) diff --git a/safe_transaction_service/history/tests/test_models.py b/safe_transaction_service/history/tests/test_models.py index 38c1fd7ef..e815c19e0 100644 --- a/safe_transaction_service/history/tests/test_models.py +++ b/safe_transaction_service/history/tests/test_models.py @@ -1391,7 +1391,9 @@ def test_with_confirmations_required(self): ) # SafeStatus not matching the EthereumTx - safe_status = SafeStatusFactory(nonce=1, threshold=8) + safe_status = SafeStatusFactory( + address=multisig_transaction.safe, nonce=1, threshold=8 + ) self.assertIsNone( MultisigTransaction.objects.with_confirmations_required() .first()