From cc655575c8b121c996bde3bfb33ba1e91f9e3872 Mon Sep 17 00:00:00 2001 From: Andrew Kozlik Date: Mon, 25 May 2020 17:04:57 +0200 Subject: [PATCH] common: Add witness field to TxInputType. --- common/protob/messages-bitcoin.proto | 1 + core/src/trezor/messages/TxInputType.py | 3 +++ legacy/firmware/protob/messages-bitcoin.options | 1 + python/src/trezorlib/messages/TxInputType.py | 3 +++ 4 files changed, 8 insertions(+) diff --git a/common/protob/messages-bitcoin.proto b/common/protob/messages-bitcoin.proto index 6ec28d244b..59b593f200 100644 --- a/common/protob/messages-bitcoin.proto +++ b/common/protob/messages-bitcoin.proto @@ -216,6 +216,7 @@ message TxAck { // optional uint32 decred_script_version = 10; // only for Decred // deprecated -> only 0 is supported // optional bytes prev_block_hash_bip115 = 11; // BIP-115 support dropped // optional uint32 prev_block_height_bip115 = 12; // BIP-115 support dropped + optional bytes witness = 13; // witness data, only set for EXTERNAL inputs } /** * Structure representing compiled transaction output diff --git a/core/src/trezor/messages/TxInputType.py b/core/src/trezor/messages/TxInputType.py index 1c4997f16c..231f43981f 100644 --- a/core/src/trezor/messages/TxInputType.py +++ b/core/src/trezor/messages/TxInputType.py @@ -26,6 +26,7 @@ class TxInputType(p.MessageType): multisig: MultisigRedeemScriptType = None, amount: int = None, decred_tree: int = None, + witness: bytes = None, ) -> None: self.address_n = address_n if address_n is not None else [] self.prev_hash = prev_hash @@ -36,6 +37,7 @@ class TxInputType(p.MessageType): self.multisig = multisig self.amount = amount self.decred_tree = decred_tree + self.witness = witness @classmethod def get_fields(cls) -> Dict: @@ -49,4 +51,5 @@ class TxInputType(p.MessageType): 7: ('multisig', MultisigRedeemScriptType, 0), 8: ('amount', p.UVarintType, 0), 9: ('decred_tree', p.UVarintType, 0), + 13: ('witness', p.BytesType, 0), } diff --git a/legacy/firmware/protob/messages-bitcoin.options b/legacy/firmware/protob/messages-bitcoin.options index e444b86c31..65aa43d750 100644 --- a/legacy/firmware/protob/messages-bitcoin.options +++ b/legacy/firmware/protob/messages-bitcoin.options @@ -31,6 +31,7 @@ TransactionType.extra_data max_size:1024 TxInputType.address_n max_count:8 TxInputType.prev_hash max_size:32 TxInputType.script_sig max_size:1650 +TxInputType.witness max_size:109 TxOutputType.address max_size:130 TxOutputType.address_n max_count:8 diff --git a/python/src/trezorlib/messages/TxInputType.py b/python/src/trezorlib/messages/TxInputType.py index 68f0df089b..4d9a985945 100644 --- a/python/src/trezorlib/messages/TxInputType.py +++ b/python/src/trezorlib/messages/TxInputType.py @@ -26,6 +26,7 @@ class TxInputType(p.MessageType): multisig: MultisigRedeemScriptType = None, amount: int = None, decred_tree: int = None, + witness: bytes = None, ) -> None: self.address_n = address_n if address_n is not None else [] self.prev_hash = prev_hash @@ -36,6 +37,7 @@ class TxInputType(p.MessageType): self.multisig = multisig self.amount = amount self.decred_tree = decred_tree + self.witness = witness @classmethod def get_fields(cls) -> Dict: @@ -49,4 +51,5 @@ class TxInputType(p.MessageType): 7: ('multisig', MultisigRedeemScriptType, 0), 8: ('amount', p.UVarintType, 0), 9: ('decred_tree', p.UVarintType, 0), + 13: ('witness', p.BytesType, 0), }