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 75b8b32 commit fa739c0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 7 additions & 6 deletions concent_api/common/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
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 fa739c0

Please sign in to comment.