Skip to content

Commit e61a554

Browse files
Pedro-Souzafaustbrian
authored andcommitted
refactor: ensure that the transaction amount is an unsigned integer (#67)
1 parent 3de2fdd commit e61a554

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

crypto/transactions/builder/transfer.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ def __init__(self, recipientId, amount, vendorField=None, fee=None):
1717
"""
1818
super().__init__()
1919
self.transaction.recipientId = recipientId
20-
self.transaction.amount = amount
20+
if type(amount) == int and amount > 0:
21+
self.transaction.amount = amount
22+
else:
23+
raise ValueError('Amount is not valid')
2124
self.transaction.vendorField = vendorField.encode() if vendorField else None
2225
if fee:
2326
self.transaction.fee = fee

0 commit comments

Comments
 (0)