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

chore(common): Add orig_hash and orig_index fields to TxInput and TxOutput.

This commit is contained in:
Andrew Kozlik 2020-09-23 19:34:36 +02:00 committed by Andrew Kozlik
parent 7ae338bd87
commit 443e0c101e
10 changed files with 63 additions and 8 deletions

View File

@ -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;

View File

@ -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),
}

View File

@ -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),
}

View File

@ -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),
}

View File

@ -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),
}

View File

@ -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

View File

@ -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),
}

View File

@ -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),
}

View File

@ -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),
}

View File

@ -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),
}