1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-02-17 01:52:02 +00:00

core/ripple: rename write_bytes to avoid name collision

This commit is contained in:
matejcik 2020-03-16 11:23:09 +01:00 committed by Tomas Susanka
parent 64584e271c
commit 694f714719

View File

@ -63,9 +63,9 @@ def write(w: bytearray, field: dict, value):
elif field["type"] == FIELD_TYPE_AMOUNT: elif field["type"] == FIELD_TYPE_AMOUNT:
w.extend(serialize_amount(value)) w.extend(serialize_amount(value))
elif field["type"] == FIELD_TYPE_ACCOUNT: elif field["type"] == FIELD_TYPE_ACCOUNT:
write_bytes(w, helpers.decode_address(value)) write_bytes_varint(w, helpers.decode_address(value))
elif field["type"] == FIELD_TYPE_VL: elif field["type"] == FIELD_TYPE_VL:
write_bytes(w, value) write_bytes_varint(w, value)
else: else:
raise ValueError("Unknown field type") raise ValueError("Unknown field type")
@ -91,7 +91,7 @@ def serialize_amount(value: int) -> bytearray:
return b return b
def write_bytes(w: bytearray, value: bytes): def write_bytes_varint(w: bytearray, value: bytes):
"""Serialize a variable length bytes.""" """Serialize a variable length bytes."""
write_varint(w, len(value)) write_varint(w, len(value))
w.extend(value) w.extend(value)