1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-28 00:01:31 +00:00

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
This commit is contained in:
Tomas Susanka 2019-07-15 13:29:11 +02:00
parent 5134cd0b80
commit d073102422
2 changed files with 4 additions and 5 deletions

View File

@ -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

View File

@ -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"))