diff --git a/common/protob/messages-bitcoin.proto b/common/protob/messages-bitcoin.proto index de2ae0176..9c5a335e6 100644 --- a/common/protob/messages-bitcoin.proto +++ b/common/protob/messages-bitcoin.proto @@ -268,7 +268,8 @@ message TxAck { optional bytes witness = 13; // witness data, only set for EXTERNAL inputs optional bytes ownership_proof = 14; // SLIP-0019 proof of ownership, only set for EXTERNAL inputs optional bytes commitment_data = 15; // optional commitment data for the SLIP-0019 proof of ownership - + optional bytes orig_hash = 16; // tx_hash of the original transaction where this input was spent (used when creating a replacement transaction) + optional uint32 orig_index = 17; // index of the input in the original transaction (used when creating a replacement transaction) } /** * Structure representing compiled transaction output @@ -291,6 +292,8 @@ message TxAck { // optional uint32 decred_script_version = 7; // only for Decred // deprecated -> only 0 is supported // optional bytes block_hash_bip115 = 8; // BIP-115 support dropped // optional uint32 block_height_bip115 = 9; // BIP-115 support dropped + optional bytes orig_hash = 10; // tx_hash of the original transaction where this output was present (used when creating a replacement transaction) + optional uint32 orig_index = 11; // index of the output in the original transaction (used when creating a replacement transaction) } } } @@ -311,12 +314,12 @@ message TxInput { optional MultisigRedeemScriptType multisig = 7; // Filled if input is going to spend multisig tx required uint64 amount = 8; // amount of previous transaction output optional uint32 decred_tree = 9; // only for Decred + reserved 10, 11, 12; // fields which are in use, or have been in the past, in TxInputType optional bytes witness = 13; // witness data, only set for EXTERNAL inputs optional bytes ownership_proof = 14; // SLIP-0019 proof of ownership, only set for EXTERNAL inputs optional bytes commitment_data = 15; // optional commitment data for the SLIP-0019 proof of ownership - - // fields which are in use, or have been in the past, in TxInputType - reserved 10, 11, 12; + optional bytes orig_hash = 16; // tx_hash of the original transaction where this input was spent (used when creating a replacement transaction) + optional uint32 orig_index = 17; // index of the input in the original transaction (used when creating a replacement transaction) } /** Data type for transaction output to be signed. @@ -329,9 +332,9 @@ message TxOutput { optional OutputScriptType script_type = 4 [default=PAYTOADDRESS]; // output script type optional MultisigRedeemScriptType multisig = 5; // defines multisig address; script_type must be PAYTOMULTISIG optional bytes op_return_data = 6; // defines op_return data; script_type must be PAYTOOPRETURN, amount must be 0 - - // fields which are in use, or have been in the past, in TxOutputType - reserved 7, 8, 9; + reserved 7, 8, 9; // fields which are in use, or have been in the past, in TxOutputType + optional bytes orig_hash = 10; // tx_hash of the original transaction where this output was present (used when creating a replacement transaction) + optional uint32 orig_index = 11; // index of the output in the original transaction (used when creating a replacement transaction) } /** Data type for metadata about previous transaction which contains the UTXO being spent. @@ -477,7 +480,7 @@ message TxAckPrevOutput { * * @next TxRequest */ - message TxAckPrevExtraData { +message TxAckPrevExtraData { option (wire_type) = 22; required TxAckPrevExtraDataWrapper tx = 1; diff --git a/core/src/trezor/messages/TxInput.py b/core/src/trezor/messages/TxInput.py index 3a7273ebd..47d8d59c8 100644 --- a/core/src/trezor/messages/TxInput.py +++ b/core/src/trezor/messages/TxInput.py @@ -30,6 +30,8 @@ class TxInput(p.MessageType): witness: bytes = None, ownership_proof: bytes = None, commitment_data: bytes = None, + orig_hash: bytes = None, + orig_index: int = None, ) -> None: self.address_n = address_n if address_n is not None else [] self.prev_hash = prev_hash @@ -43,6 +45,8 @@ class TxInput(p.MessageType): self.witness = witness self.ownership_proof = ownership_proof self.commitment_data = commitment_data + self.orig_hash = orig_hash + self.orig_index = orig_index @classmethod def get_fields(cls) -> Dict: @@ -59,4 +63,6 @@ class TxInput(p.MessageType): 13: ('witness', p.BytesType, None), 14: ('ownership_proof', p.BytesType, None), 15: ('commitment_data', p.BytesType, None), + 16: ('orig_hash', p.BytesType, None), + 17: ('orig_index', p.UVarintType, None), } diff --git a/core/src/trezor/messages/TxInputType.py b/core/src/trezor/messages/TxInputType.py index b7621fe93..2f80a3605 100644 --- a/core/src/trezor/messages/TxInputType.py +++ b/core/src/trezor/messages/TxInputType.py @@ -30,6 +30,8 @@ class TxInputType(p.MessageType): witness: bytes = None, ownership_proof: bytes = None, commitment_data: bytes = None, + orig_hash: bytes = None, + orig_index: int = None, ) -> None: self.address_n = address_n if address_n is not None else [] self.prev_hash = prev_hash @@ -43,6 +45,8 @@ class TxInputType(p.MessageType): self.witness = witness self.ownership_proof = ownership_proof self.commitment_data = commitment_data + self.orig_hash = orig_hash + self.orig_index = orig_index @classmethod def get_fields(cls) -> Dict: @@ -59,4 +63,6 @@ class TxInputType(p.MessageType): 13: ('witness', p.BytesType, None), 14: ('ownership_proof', p.BytesType, None), 15: ('commitment_data', p.BytesType, None), + 16: ('orig_hash', p.BytesType, None), + 17: ('orig_index', p.UVarintType, None), } diff --git a/core/src/trezor/messages/TxOutput.py b/core/src/trezor/messages/TxOutput.py index c09685250..0108547cd 100644 --- a/core/src/trezor/messages/TxOutput.py +++ b/core/src/trezor/messages/TxOutput.py @@ -24,6 +24,8 @@ class TxOutput(p.MessageType): script_type: EnumTypeOutputScriptType = 0, multisig: MultisigRedeemScriptType = None, op_return_data: bytes = None, + orig_hash: bytes = None, + orig_index: int = None, ) -> None: self.address_n = address_n if address_n is not None else [] self.amount = amount @@ -31,6 +33,8 @@ class TxOutput(p.MessageType): self.script_type = script_type self.multisig = multisig self.op_return_data = op_return_data + self.orig_hash = orig_hash + self.orig_index = orig_index @classmethod def get_fields(cls) -> Dict: @@ -41,4 +45,6 @@ class TxOutput(p.MessageType): 4: ('script_type', p.EnumType("OutputScriptType", (0, 1, 2, 3, 4, 5)), 0), # default=PAYTOADDRESS 5: ('multisig', MultisigRedeemScriptType, None), 6: ('op_return_data', p.BytesType, None), + 10: ('orig_hash', p.BytesType, None), + 11: ('orig_index', p.UVarintType, None), } diff --git a/core/src/trezor/messages/TxOutputType.py b/core/src/trezor/messages/TxOutputType.py index 7ab50e121..a749614b3 100644 --- a/core/src/trezor/messages/TxOutputType.py +++ b/core/src/trezor/messages/TxOutputType.py @@ -24,6 +24,8 @@ class TxOutputType(p.MessageType): script_type: EnumTypeOutputScriptType = 0, multisig: MultisigRedeemScriptType = None, op_return_data: bytes = None, + orig_hash: bytes = None, + orig_index: int = None, ) -> None: self.address_n = address_n if address_n is not None else [] self.amount = amount @@ -31,6 +33,8 @@ class TxOutputType(p.MessageType): self.script_type = script_type self.multisig = multisig self.op_return_data = op_return_data + self.orig_hash = orig_hash + self.orig_index = orig_index @classmethod def get_fields(cls) -> Dict: @@ -41,4 +45,6 @@ class TxOutputType(p.MessageType): 4: ('script_type', p.EnumType("OutputScriptType", (0, 1, 2, 3, 4, 5)), 0), # default=PAYTOADDRESS 5: ('multisig', MultisigRedeemScriptType, None), 6: ('op_return_data', p.BytesType, None), + 10: ('orig_hash', p.BytesType, None), + 11: ('orig_index', p.UVarintType, None), } diff --git a/legacy/firmware/protob/messages-bitcoin.options b/legacy/firmware/protob/messages-bitcoin.options index fbca75ef2..311553bc9 100644 --- a/legacy/firmware/protob/messages-bitcoin.options +++ b/legacy/firmware/protob/messages-bitcoin.options @@ -34,10 +34,12 @@ TxInputType.script_sig max_size:1650 TxInputType.witness max_size:109 TxInputType.ownership_proof max_size:171 TxInputType.commitment_data max_size:32 +TxInputType.orig_hash max_size:32 TxOutputType.address max_size:130 TxOutputType.address_n max_count:8 TxOutputType.op_return_data max_size:80 +TxOutputType.orig_hash max_size:32 TxOutputBinType.script_pubkey max_size:520 @@ -76,10 +78,12 @@ TxInput.script_sig max_size:1650 TxInput.witness max_size:109 TxInput.ownership_proof max_size:171 TxInput.commitment_data max_size:32 +TxInput.orig_hash max_size:32 TxOutput.address max_size:130 TxOutput.address_n max_count:8 TxOutput.op_return_data max_size:80 +TxOutput.orig_hash max_size:32 PrevInput.prev_hash max_size:32 PrevInput.script_sig max_size:1650 diff --git a/python/src/trezorlib/messages/TxInput.py b/python/src/trezorlib/messages/TxInput.py index cde3b9d1a..5dfc8fde0 100644 --- a/python/src/trezorlib/messages/TxInput.py +++ b/python/src/trezorlib/messages/TxInput.py @@ -30,6 +30,8 @@ class TxInput(p.MessageType): witness: bytes = None, ownership_proof: bytes = None, commitment_data: bytes = None, + orig_hash: bytes = None, + orig_index: int = None, ) -> None: self.address_n = address_n if address_n is not None else [] self.prev_hash = prev_hash @@ -43,6 +45,8 @@ class TxInput(p.MessageType): self.witness = witness self.ownership_proof = ownership_proof self.commitment_data = commitment_data + self.orig_hash = orig_hash + self.orig_index = orig_index @classmethod def get_fields(cls) -> Dict: @@ -59,4 +63,6 @@ class TxInput(p.MessageType): 13: ('witness', p.BytesType, None), 14: ('ownership_proof', p.BytesType, None), 15: ('commitment_data', p.BytesType, None), + 16: ('orig_hash', p.BytesType, None), + 17: ('orig_index', p.UVarintType, None), } diff --git a/python/src/trezorlib/messages/TxInputType.py b/python/src/trezorlib/messages/TxInputType.py index 25920c6d7..70708a31c 100644 --- a/python/src/trezorlib/messages/TxInputType.py +++ b/python/src/trezorlib/messages/TxInputType.py @@ -30,6 +30,8 @@ class TxInputType(p.MessageType): witness: bytes = None, ownership_proof: bytes = None, commitment_data: bytes = None, + orig_hash: bytes = None, + orig_index: int = None, ) -> None: self.address_n = address_n if address_n is not None else [] self.prev_hash = prev_hash @@ -43,6 +45,8 @@ class TxInputType(p.MessageType): self.witness = witness self.ownership_proof = ownership_proof self.commitment_data = commitment_data + self.orig_hash = orig_hash + self.orig_index = orig_index @classmethod def get_fields(cls) -> Dict: @@ -59,4 +63,6 @@ class TxInputType(p.MessageType): 13: ('witness', p.BytesType, None), 14: ('ownership_proof', p.BytesType, None), 15: ('commitment_data', p.BytesType, None), + 16: ('orig_hash', p.BytesType, None), + 17: ('orig_index', p.UVarintType, None), } diff --git a/python/src/trezorlib/messages/TxOutput.py b/python/src/trezorlib/messages/TxOutput.py index 8f4c4f46a..5430d1cd4 100644 --- a/python/src/trezorlib/messages/TxOutput.py +++ b/python/src/trezorlib/messages/TxOutput.py @@ -24,6 +24,8 @@ class TxOutput(p.MessageType): script_type: EnumTypeOutputScriptType = 0, multisig: MultisigRedeemScriptType = None, op_return_data: bytes = None, + orig_hash: bytes = None, + orig_index: int = None, ) -> None: self.address_n = address_n if address_n is not None else [] self.amount = amount @@ -31,6 +33,8 @@ class TxOutput(p.MessageType): self.script_type = script_type self.multisig = multisig self.op_return_data = op_return_data + self.orig_hash = orig_hash + self.orig_index = orig_index @classmethod def get_fields(cls) -> Dict: @@ -41,4 +45,6 @@ class TxOutput(p.MessageType): 4: ('script_type', p.EnumType("OutputScriptType", (0, 1, 2, 3, 4, 5)), 0), # default=PAYTOADDRESS 5: ('multisig', MultisigRedeemScriptType, None), 6: ('op_return_data', p.BytesType, None), + 10: ('orig_hash', p.BytesType, None), + 11: ('orig_index', p.UVarintType, None), } diff --git a/python/src/trezorlib/messages/TxOutputType.py b/python/src/trezorlib/messages/TxOutputType.py index 6db15b323..7da908d4a 100644 --- a/python/src/trezorlib/messages/TxOutputType.py +++ b/python/src/trezorlib/messages/TxOutputType.py @@ -24,6 +24,8 @@ class TxOutputType(p.MessageType): script_type: EnumTypeOutputScriptType = 0, multisig: MultisigRedeemScriptType = None, op_return_data: bytes = None, + orig_hash: bytes = None, + orig_index: int = None, ) -> None: self.address_n = address_n if address_n is not None else [] self.amount = amount @@ -31,6 +33,8 @@ class TxOutputType(p.MessageType): self.script_type = script_type self.multisig = multisig self.op_return_data = op_return_data + self.orig_hash = orig_hash + self.orig_index = orig_index @classmethod def get_fields(cls) -> Dict: @@ -41,4 +45,6 @@ class TxOutputType(p.MessageType): 4: ('script_type', p.EnumType("OutputScriptType", (0, 1, 2, 3, 4, 5)), 0), # default=PAYTOADDRESS 5: ('multisig', MultisigRedeemScriptType, None), 6: ('op_return_data', p.BytesType, None), + 10: ('orig_hash', p.BytesType, None), + 11: ('orig_index', p.UVarintType, None), }