Skip to content

Commit

Permalink
refactor(api): prevent duplicate tx earlier
Browse files Browse the repository at this point in the history
  • Loading branch information
jansegre committed Jun 10, 2024
1 parent b20be70 commit f70cdef
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions hathor/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -895,6 +895,9 @@ def push_tx(self, tx: Transaction, allow_non_standard_script: bool = False,
max_output_script_size: int | None = None) -> None:
"""Used by all APIs that accept a new transaction (like push_tx)
"""
if self.tx_storage.transaction_exists(tx.hash):
raise InvalidNewTransaction('Transaction already exists {}'.format(tx.hash_hex))

if max_output_script_size is None:
max_output_script_size = self._settings.PUSHTX_MAX_OUTPUT_SCRIPT_SIZE

Expand Down

0 comments on commit f70cdef

Please sign in to comment.