Skip to content

Commit

Permalink
error message when output is negativ
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-volz committed Oct 6, 2023
1 parent c855e27 commit aedb65c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion defichain/transactions/rawtransactions/txoutput.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from typing import Any

from .txbase import TxBase
from defichain.exceptions.transactions import DeserializeError
from defichain.exceptions.transactions import DeserializeError, InputError
from defichain.transactions.constants import OPCodes, DefiTx_SIGNATURE
from defichain.transactions.utils import Converter, Calculate
from defichain.transactions.defitx.modules.basedefitx import BaseDefiTx
Expand Down Expand Up @@ -73,6 +73,8 @@ def get_bytes_tokenId(self) -> bytes:

# Set Information
def set_value(self, value: int) -> None:
if value < 0:
raise InputError("The output value is negative. It must be positive or at least zero.")
self._value = value

def set_script(self, script: str) -> None:
Expand Down

0 comments on commit aedb65c

Please sign in to comment.