1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-27 01:48:17 +00:00

stellar.py now returns a tuple from parse_transaction_bytes and no longer uses a reserved argument name

This commit is contained in:
ZuluCrypto 2018-04-20 10:34:26 -06:00
parent ea6ced4dae
commit 61f5e1df61
No known key found for this signature in database
GPG Key ID: 0D1266F87C28A2E1

View File

@ -63,7 +63,7 @@ def address_to_public_key(address_str):
return decoded[1:-2] return decoded[1:-2]
def parse_transaction_bytes(bytes): def parse_transaction_bytes(tx_bytes):
"""Parses base64data into a map with the following keys: """Parses base64data into a map with the following keys:
tx - a StellarSignTx describing the transaction header tx - a StellarSignTx describing the transaction header
operations - an array of protobuf message objects for each operation operations - an array of protobuf message objects for each operation
@ -72,7 +72,7 @@ def parse_transaction_bytes(bytes):
protocol_version=1 protocol_version=1
) )
operations = [] operations = []
unpacker = xdrlib.Unpacker(bytes) unpacker = xdrlib.Unpacker(tx_bytes)
tx.source_account = _xdr_read_address(unpacker) tx.source_account = _xdr_read_address(unpacker)
tx.fee = unpacker.unpack_uint() tx.fee = unpacker.unpack_uint()
@ -108,10 +108,7 @@ def parse_transaction_bytes(bytes):
for i in range(tx.num_operations): for i in range(tx.num_operations):
operations.append(_parse_operation_bytes(unpacker)) operations.append(_parse_operation_bytes(unpacker))
return { return tx, operations
"tx": tx,
"operations": operations
}
def _parse_operation_bytes(unpacker): def _parse_operation_bytes(unpacker):
"""Returns a protobuf message representing the next operation as read from """Returns a protobuf message representing the next operation as read from