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:
parent
26173c243a
commit
c2bad83296
@ -189,17 +189,18 @@ def sign_tx(
|
|||||||
tx_type=tx_type,
|
tx_type=tx_type,
|
||||||
)
|
)
|
||||||
|
|
||||||
if data:
|
if data is None:
|
||||||
msg.data_length = len(data)
|
data = b""
|
||||||
data, chunk = data[1024:], data[:1024]
|
|
||||||
msg.data_initial_chunk = chunk
|
msg.data_length = len(data)
|
||||||
|
data, chunk = data[1024:], data[:1024]
|
||||||
|
msg.data_initial_chunk = chunk
|
||||||
|
|
||||||
response = client.call(msg)
|
response = client.call(msg)
|
||||||
assert isinstance(response, messages.EthereumTxRequest)
|
assert isinstance(response, messages.EthereumTxRequest)
|
||||||
|
|
||||||
while response.data_length is not None:
|
while response.data_length is not None:
|
||||||
data_length = response.data_length
|
data_length = response.data_length
|
||||||
assert data is not None
|
|
||||||
data, chunk = data[data_length:], data[:data_length]
|
data, chunk = data[data_length:], data[:data_length]
|
||||||
response = client.call(messages.EthereumTxAck(data_chunk=chunk))
|
response = client.call(messages.EthereumTxAck(data_chunk=chunk))
|
||||||
assert isinstance(response, messages.EthereumTxRequest)
|
assert isinstance(response, messages.EthereumTxRequest)
|
||||||
|
Loading…
Reference in New Issue
Block a user