1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-17 05:03:07 +00:00

feat(common): Add script_pubkey field to TxInput message.

This commit is contained in:
Andrew Kozlik 2021-10-18 15:21:21 +02:00 committed by Andrew Kozlik
parent 926365b64e
commit 13cbb59082
9 changed files with 18 additions and 3 deletions

View File

@ -300,6 +300,7 @@ message TxAck {
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)
optional DecredStakingSpendType decred_staking_spend = 18; // if not None this holds the type of stake spend: revocation or stake generation
optional bytes script_pubkey = 19; // scriptPubKey of the previous output spent by this input, only set of EXTERNAL inputs
}
/**
* Structure representing compiled transaction output
@ -351,6 +352,7 @@ message TxInput {
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)
optional DecredStakingSpendType decred_staking_spend = 18; // if not None this holds the type of stake spend: revocation or stake generation
optional bytes script_pubkey = 19; // scriptPubKey of the previous output spent by this input, only set of EXTERNAL inputs
}
/** Data type for transaction output to be signed.
@ -399,7 +401,7 @@ message PrevInput {
optional uint32 decred_tree = 9; // only for Decred
// fields that are in use, or have been in the past, in TxInputType
reserved 1, 6, 7, 8, 10, 11, 12, 13, 14, 15;
reserved 1, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19;
}
/** Data type for outputs of previous transactions.

View File

@ -0,0 +1 @@
Add script_pubkey field to TxInput message.

View File

@ -643,6 +643,7 @@ if TYPE_CHECKING:
orig_hash: "bytes | None"
orig_index: "int | None"
decred_staking_spend: "DecredStakingSpendType | None"
script_pubkey: "bytes | None"
def __init__(
self,
@ -662,6 +663,7 @@ if TYPE_CHECKING:
orig_hash: "bytes | None" = None,
orig_index: "int | None" = None,
decred_staking_spend: "DecredStakingSpendType | None" = None,
script_pubkey: "bytes | None" = None,
) -> None:
pass

View File

@ -154,7 +154,7 @@ signing party hasn't signed their input yet (i.e., with two Trezors, one must si
so that the other can include a pre-signed input), they can instead provide a
[SLIP-19](https://github.com/satoshilabs/slips/blob/master/slip-0019.md)
ownership proof in the `ownership_proof` field, with optional commitment data in
`commitment_data`.
`commitment_data`. The `script_pubkey` field is required for all external inputs.
### Transaction output

View File

@ -0,0 +1 @@
Add script_pubkey field to TxInput message.

View File

@ -32,7 +32,7 @@
#define MSG_IN_ENCODED_SIZE (16 * 1024)
// Maximum size of a C struct containing a decoded incoming message.
#define MSG_IN_DECODED_SIZE (15 * 1024)
#define MSG_IN_DECODED_SIZE (16 * 1024)
// Buffer size for outgoing USB packets with headers.
#define MSG_OUT_BUFFER_SIZE (3 * 1024)

View File

@ -35,6 +35,7 @@ TxInputType.witness max_size:109
TxInputType.ownership_proof max_size:171
TxInputType.commitment_data max_size:32
TxInputType.orig_hash max_size:32
TxInputType.script_pubkey max_size:520
TxOutputType.address max_size:130
TxOutputType.address_n max_count:8
@ -62,6 +63,7 @@ TxInput.witness max_size:109
TxInput.ownership_proof max_size:171
TxInput.commitment_data max_size:32
TxInput.orig_hash max_size:32
TxInput.script_pubkey max_size:520
TxOutput.address max_size:130
TxOutput.address_n max_count:8

View File

@ -0,0 +1 @@
Add script_pubkey field to TxInput message.

View File

@ -1197,6 +1197,7 @@ class TxInput(protobuf.MessageType):
16: protobuf.Field("orig_hash", "bytes", repeated=False, required=False),
17: protobuf.Field("orig_index", "uint32", repeated=False, required=False),
18: protobuf.Field("decred_staking_spend", "DecredStakingSpendType", repeated=False, required=False),
19: protobuf.Field("script_pubkey", "bytes", repeated=False, required=False),
}
def __init__(
@ -1217,6 +1218,7 @@ class TxInput(protobuf.MessageType):
orig_hash: Optional["bytes"] = None,
orig_index: Optional["int"] = None,
decred_staking_spend: Optional["DecredStakingSpendType"] = None,
script_pubkey: Optional["bytes"] = None,
) -> None:
self.address_n = address_n if address_n is not None else []
self.prev_hash = prev_hash
@ -1233,6 +1235,7 @@ class TxInput(protobuf.MessageType):
self.orig_hash = orig_hash
self.orig_index = orig_index
self.decred_staking_spend = decred_staking_spend
self.script_pubkey = script_pubkey
class TxOutput(protobuf.MessageType):
@ -1650,6 +1653,7 @@ class TxInputType(protobuf.MessageType):
16: protobuf.Field("orig_hash", "bytes", repeated=False, required=False),
17: protobuf.Field("orig_index", "uint32", repeated=False, required=False),
18: protobuf.Field("decred_staking_spend", "DecredStakingSpendType", repeated=False, required=False),
19: protobuf.Field("script_pubkey", "bytes", repeated=False, required=False),
}
def __init__(
@ -1670,6 +1674,7 @@ class TxInputType(protobuf.MessageType):
orig_hash: Optional["bytes"] = None,
orig_index: Optional["int"] = None,
decred_staking_spend: Optional["DecredStakingSpendType"] = None,
script_pubkey: Optional["bytes"] = None,
) -> None:
self.address_n = address_n if address_n is not None else []
self.prev_hash = prev_hash
@ -1686,6 +1691,7 @@ class TxInputType(protobuf.MessageType):
self.orig_hash = orig_hash
self.orig_index = orig_index
self.decred_staking_spend = decred_staking_spend
self.script_pubkey = script_pubkey
class TxOutputBinType(protobuf.MessageType):