Skip to content

Commit

Permalink
fixup! Add TransactionNonceNotMatch exception
Browse files Browse the repository at this point in the history
  • Loading branch information
kbeker committed Jul 13, 2018
1 parent b54dfd6 commit f6890f9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
14 changes: 7 additions & 7 deletions concent_api/common/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +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'
TRANSACTION_NONCE_NOT_MATCH = 'transaction.nonce.not_match'
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):
Expand Down
2 changes: 1 addition & 1 deletion concent_api/core/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ class FrameNumberValidationError(ConcentBaseException):
pass


class TransactionNonceNotMatchError(ConcentBaseException):
class TransactionNonceNotMatchError(Exception):
pass
2 changes: 2 additions & 0 deletions concent_api/core/payments/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from core.models import PendingEthereumTransaction

from core.exceptions import TransactionNonceNotMatchError
from common.constants import ErrorCode

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit f6890f9

Please sign in to comment.