Skip to content

Commit

Permalink
Merge #640: trezor: optimize signing speed by not serializing transac…
Browse files Browse the repository at this point in the history
…tion in trezor

021c7de trezor: optimize signing speed by not serializing transaction in trezor (Pavol Rusnak)

Pull request description:

  Since HWI is not using TxRequestSerializedType.serialized_tx we might ask the device not to serialize transactions by setting SignTx.serialize=False

  The SignTx.serialize field is introduced in trezorlib 0.13.4. This PR only backports this field to local copy of trezorlib and nothing else.

ACKs for top commit:
  achow101:
    ACK 021c7de

Tree-SHA512: 57aaac801aa4839b2ea91ea09c6e974a97ec078ac48afffb889c1f19092628da87d107bee018acd08890795c372cd3f1e5b03d46f177a9e86b8fd20f0e443a81
  • Loading branch information
achow101 committed Nov 10, 2022
2 parents 44f26a8 + 021c7de commit 7e3e2e6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions hwilib/devices/trezor.py
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,7 @@ def ignore_input() -> None:
prev_txes=prevtxs,
version=tx.tx_version,
lock_time=tx.compute_lock_time(),
serialize=False,
)

# Each input has one signature
Expand Down
3 changes: 3 additions & 0 deletions hwilib/devices/trezorlib/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,7 @@ class SignTx(protobuf.MessageType):
10: protobuf.Field("branch_id", "uint32", repeated=False, required=False),
11: protobuf.Field("amount_unit", "AmountUnit", repeated=False, required=False),
12: protobuf.Field("decred_staking_ticket", "bool", repeated=False, required=False),
13: protobuf.Field("serialize", "bool", repeated=False, required=False),
}

def __init__(
Expand All @@ -641,6 +642,7 @@ def __init__(
branch_id: Optional["int"] = None,
amount_unit: Optional["AmountUnit"] = AmountUnit.BITCOIN,
decred_staking_ticket: Optional["bool"] = False,
serialize: Optional["bool"] = True,
) -> None:
self.outputs_count = outputs_count
self.inputs_count = inputs_count
Expand All @@ -654,6 +656,7 @@ def __init__(
self.branch_id = branch_id
self.amount_unit = amount_unit
self.decred_staking_ticket = decred_staking_ticket
self.serialize = serialize


class TxRequest(protobuf.MessageType):
Expand Down

0 comments on commit 7e3e2e6

Please sign in to comment.