1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-18 04:18:10 +00:00

refactor(python): improve handling of data for trezorlib.ethereum.sign_tx()

This commit is contained in:
matejcik 2021-11-26 14:43:42 +01:00 committed by matejcik
parent 26173c243a
commit c2bad83296

View File

@ -189,7 +189,9 @@ def sign_tx(
tx_type=tx_type,
)
if data:
if data is None:
data = b""
msg.data_length = len(data)
data, chunk = data[1024:], data[:1024]
msg.data_initial_chunk = chunk
@ -199,7 +201,6 @@ def sign_tx(
while response.data_length is not None:
data_length = response.data_length
assert data is not None
data, chunk = data[data_length:], data[:data_length]
response = client.call(messages.EthereumTxAck(data_chunk=chunk))
assert isinstance(response, messages.EthereumTxRequest)