core/ripple: increase the maximum amount allowed to be sent

The maximum amount is defined in [Ripple's docs](https://xrpl.org/basic-data-types.html#currencies) but it's most likely in XRP and not in drops ("satoshi" equivalent). This commit increase the value to the drops equivalent.

closes #327
pull/337/head
Tomas Susanka 5 years ago
parent 5134cd0b80
commit d073102422

@ -17,6 +17,9 @@ DIVISIBILITY = const(6) # 1000000 drops equal 1 XRP
MIN_FEE = const(10)
# max is not defined officially but we check to make sure
MAX_FEE = const(1000000) # equals 1 XRP
# https://xrpl.org/basic-data-types.html#specifying-currency-amounts
# the value in docs is in XRP, we declare it here in drops
MAX_ALLOWED_AMOUNT = const(100000000000000000)
FLAG_FULLY_CANONICAL = 0x80000000

@ -8,8 +8,6 @@
# the actual data follow. This currently only supports the Payment
# transaction type and the fields that are required for it.
from micropython import const
from trezor.messages.RippleSignTx import RippleSignTx
from . import helpers
@ -82,11 +80,9 @@ def write_type(w: bytearray, field: dict):
def serialize_amount(value: int) -> bytearray:
MAX_ALLOWED_AMOUNT = const(100000000000)
if value < 0:
raise ValueError("Only non-negative integers are supported")
if value > MAX_ALLOWED_AMOUNT:
if value > helpers.MAX_ALLOWED_AMOUNT:
raise ValueError("Value is too large")
b = bytearray(value.to_bytes(8, "big"))

Loading…
Cancel
Save