From fa739c02fb9aec0880bd2170ec6042ec9cd5b246 Mon Sep 17 00:00:00 2001 From: Karol Beker Date: Fri, 13 Jul 2018 08:27:43 +0200 Subject: [PATCH] fixup! Add TransactionNonceNotMatch exception --- concent_api/common/constants.py | 13 +++++++------ concent_api/core/payments/storage.py | 2 ++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/concent_api/common/constants.py b/concent_api/common/constants.py index 4a0a663cd..f170deb6e 100644 --- a/concent_api/common/constants.py +++ b/concent_api/common/constants.py @@ -60,12 +60,13 @@ class ErrorCode(enum.Enum): QUEUE_WRONG_STATE = 'queue.wrong_state' REQUEST_BODY_NOT_EMPTY = 'request_body.not_empty' SUBTASK_DUPLICATE_REQUEST = 'subtask.duplicate_request' - VERIFIER_COMPUTING_SSIM_FAILED = 'verifier.computing_ssim_failed' - VERIFIER_FILE_DOWNLOAD_FAILED = 'verifier.file_download_failed' - VERIFIER_LOADING_FILES_INTO_MEMORY_FAILED = 'verifier.loading_files_into_memory_failed' - VERIFIER_LOADING_FILES_WITH_OPENCV_FAILED = 'verifier.loading_files_with_opencv_failed' - VERIFIER_RUNNING_BLENDER_FAILED = 'verifier.running_blender_failed' - VERIFIER_UNPACKING_ARCHIVE_FAILED = 'verifier.unpacking_archive_failed' + TRANSACTION_NONCE_MISMATCH = 'transaction.nonce.mismatch' + VERIFIER_COMPUTING_SSIM_FAILED = 'verifier.computing_ssim_failed' + VERIFIER_FILE_DOWNLOAD_FAILED = 'verifier.file_download_failed' + VERIFIER_LOADING_FILES_INTO_MEMORY_FAILED = 'verifier.loading_files_into_memory_failed' + VERIFIER_LOADING_FILES_WITH_OPENCV_FAILED = 'verifier.loading_files_with_opencv_failed' + VERIFIER_RUNNING_BLENDER_FAILED = 'verifier.running_blender_failed' + VERIFIER_UNPACKING_ARCHIVE_FAILED = 'verifier.unpacking_archive_failed' class MessageIdField(enum.Enum): diff --git a/concent_api/core/payments/storage.py b/concent_api/core/payments/storage.py index 42c40417b..ab6f5a3b6 100644 --- a/concent_api/core/payments/storage.py +++ b/concent_api/core/payments/storage.py @@ -11,6 +11,7 @@ from core.models import PendingEthereumTransaction from core.exceptions import TransactionNonceNotMatchError +from common.constants import ErrorCode logger = logging.getLogger(__name__) @@ -73,6 +74,7 @@ def put_tx_and_inc_nonce(self, tx: Transaction) -> None: f'Transaction nonce does not match. ' f'Current={global_transaction_state.nonce}, ' f'Transaction={tx.nonce}', + ErrorCode.TRANSACTION_NONCE_MISMATCH, ) pending_ethereum_transaction = PendingEthereumTransaction(