chore: make tx type names shorter

as suggested by @andrewkozlik:
TxAckInputType -> TxInput
TxAckOutputType -> TxOutput
TxAckPrevTxType -> PrevTx
TxAckPrevInputType -> PrevInput
TxAckPrevOutputType -> PrevOutput
pull/1279/head
matejcik 4 years ago committed by matejcik
parent b6b65bffff
commit 0eed360037

@ -298,7 +298,7 @@ message TxAck {
/** Data type for transaction input to be signed.
* @embed
*/
message TxAckInputType {
message TxInput {
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
required bytes prev_hash = 2; // hash of previous transaction output to spend by this input
required uint32 prev_index = 3; // index of previous output to spend
@ -317,7 +317,7 @@ message TxAckInputType {
/** Data type for transaction output to be signed.
* @embed
*/
message TxAckOutputType {
message TxOutput {
optional string address = 1; // destination address in Base58 encoding; script_type must be PAYTOADDRESS
repeated uint32 address_n = 2; // BIP-32 path to derive the destination (used for change addresses)
required uint64 amount = 3; // amount to spend in satoshis
@ -329,7 +329,7 @@ message TxAckOutputType {
/** Data type for metadata about previous transaction which contains the UTXO being spent.
* @embed
*/
message TxAckPrevTxType {
message PrevTx {
required uint32 version = 1;
required uint32 lock_time = 4;
required uint32 inputs_count = 6;
@ -344,7 +344,7 @@ message TxAckPrevTxType {
/** Data type for inputs of previous transactions.
* @embed
*/
message TxAckPrevInputType {
message PrevInput {
required bytes prev_hash = 2; // hash of previous transaction output to spend by this input
required uint32 prev_index = 3; // index of previous output to spend
required bytes script_sig = 4; // script signature
@ -355,7 +355,7 @@ message TxAckPrevInputType {
/** Data type for outputs of previous transactions.
* @embed
*/
message TxAckPrevOutputType {
message PrevOutput {
required uint64 amount = 1; // amount sent to this output
required bytes script_pubkey = 2; // scriptPubkey of this output
optional uint32 decred_script_version = 3; // only for Decred
@ -373,7 +373,7 @@ message TxAckInput {
required TxAckInputWrapper tx = 1;
message TxAckInputWrapper {
required TxAckInputType input = 2;
required TxInput input = 2;
}
}
@ -389,7 +389,7 @@ message TxAckOutput {
required TxAckOutputWrapper tx = 1;
message TxAckOutputWrapper {
required TxAckOutputType output = 5;
required TxOutput output = 5;
}
}
@ -402,7 +402,7 @@ message TxAckOutput {
message TxAckPrevMeta {
option (wire_type) = 22;
required TxAckPrevTxType tx = 1;
required PrevTx tx = 1;
}
/**
@ -417,7 +417,7 @@ message TxAckPrevInput {
required TxAckPrevInputWrapper tx = 1;
message TxAckPrevInputWrapper {
required TxAckPrevInputType input = 2;
required PrevInput input = 2;
}
}
@ -434,7 +434,7 @@ message TxAckPrevOutput {
required TxAckPrevOutputWrapper tx = 1;
message TxAckPrevOutputWrapper {
required TxAckPrevOutputType output = 3;
required PrevOutput output = 3;
}
}

@ -9,7 +9,7 @@ if False:
from trezor.messages.AuthorizeCoinJoin import AuthorizeCoinJoin
from trezor.messages.GetOwnershipProof import GetOwnershipProof
from trezor.messages.SignTx import SignTx
from trezor.messages.TxAckInputType import TxAckInputType
from trezor.messages.TxInput import TxInput
from apps.common.coininfo import CoinInfo
from apps.common.keychain import Keychain
@ -47,7 +47,7 @@ class CoinJoinAuthorization:
and msg.commitment_data[:-_ROUND_ID_LEN] == self.coordinator.encode()
)
def check_sign_tx_input(self, txi: TxAckInputType, coin: CoinInfo) -> bool:
def check_sign_tx_input(self, txi: TxInput, coin: CoinInfo) -> bool:
# Check whether the current input matches the parameters of the request.
return (
len(txi.address_n) >= BIP32_WALLET_DEPTH

@ -25,8 +25,8 @@ if False:
from typing import List, Optional, Tuple
from trezor.messages.MultisigRedeemScriptType import MultisigRedeemScriptType
from trezor.messages.TxAckInputType import TxAckInputType
from trezor.messages.TxAckInputType import EnumTypeInputScriptType
from trezor.messages.TxInput import TxInput
from trezor.messages.TxInput import EnumTypeInputScriptType
from apps.common.coininfo import CoinInfo
@ -115,7 +115,7 @@ def output_derive_script(address: str, coin: CoinInfo) -> bytes:
# see https://github.com/bitcoin/bips/blob/master/bip-0143.mediawiki#specification
# item 5 for details
def bip143_derive_script_code(
txi: TxAckInputType, public_keys: List[bytes], threshold: int, coin: CoinInfo
txi: TxInput, public_keys: List[bytes], threshold: int, coin: CoinInfo
) -> bytearray:
if len(public_keys) > 1:
return output_script_multisig(public_keys, threshold)

@ -10,8 +10,8 @@ from . import helpers, tx_weight
if False:
from trezor.messages.SignTx import SignTx
from trezor.messages.TxAckInputType import TxAckInputType
from trezor.messages.TxAckOutputType import TxAckOutputType
from trezor.messages.TxInput import TxInput
from trezor.messages.TxOutput import TxOutput
from apps.common.coininfo import CoinInfo
@ -38,25 +38,23 @@ class Approver:
self.total_out = 0 # sum of output amounts
self.change_out = 0 # change output amount
async def add_internal_input(self, txi: TxAckInputType) -> None:
async def add_internal_input(self, txi: TxInput) -> None:
self.weight.add_input(txi)
self.total_in += txi.amount
self.min_sequence = min(self.min_sequence, txi.sequence)
def add_external_input(self, txi: TxAckInputType) -> None:
def add_external_input(self, txi: TxInput) -> None:
self.weight.add_input(txi)
self.total_in += txi.amount
self.external_in += txi.amount
self.min_sequence = min(self.min_sequence, txi.sequence)
def add_change_output(self, txo: TxAckOutputType, script_pubkey: bytes) -> None:
def add_change_output(self, txo: TxOutput, script_pubkey: bytes) -> None:
self.weight.add_output(script_pubkey)
self.total_out += txo.amount
self.change_out += txo.amount
async def add_external_output(
self, txo: TxAckOutputType, script_pubkey: bytes
) -> None:
async def add_external_output(self, txo: TxOutput, script_pubkey: bytes) -> None:
self.weight.add_output(script_pubkey)
self.total_out += txo.amount
@ -72,19 +70,17 @@ class BasicApprover(Approver):
super().__init__(tx, coin)
self.change_count = 0 # the number of change-outputs
async def add_internal_input(self, txi: TxAckInputType) -> None:
async def add_internal_input(self, txi: TxInput) -> None:
if not addresses.validate_full_path(txi.address_n, self.coin, txi.script_type):
await helpers.confirm_foreign_address(txi.address_n)
await super().add_internal_input(txi)
def add_change_output(self, txo: TxAckOutputType, script_pubkey: bytes) -> None:
def add_change_output(self, txo: TxOutput, script_pubkey: bytes) -> None:
super().add_change_output(txo, script_pubkey)
self.change_count += 1
async def add_external_output(
self, txo: TxAckOutputType, script_pubkey: bytes
) -> None:
async def add_external_output(self, txo: TxOutput, script_pubkey: bytes) -> None:
await super().add_external_output(txo, script_pubkey)
await helpers.confirm_output(txo, self.coin)
@ -145,22 +141,20 @@ class CoinJoinApprover(Approver):
# flag indicating whether our outputs are gaining any anonymity
self.anonymity = False
async def add_internal_input(self, txi: TxAckInputType) -> None:
async def add_internal_input(self, txi: TxInput) -> None:
self.our_weight.add_input(txi)
if not self.authorization.check_sign_tx_input(txi, self.coin):
raise wire.ProcessError("Unauthorized path")
await super().add_internal_input(txi)
def add_change_output(self, txo: TxAckOutputType, script_pubkey: bytes) -> None:
def add_change_output(self, txo: TxOutput, script_pubkey: bytes) -> None:
super().add_change_output(txo, script_pubkey)
self._add_output(txo, script_pubkey)
self.our_weight.add_output(script_pubkey)
self.group_our_count += 1
async def add_external_output(
self, txo: TxAckOutputType, script_pubkey: bytes
) -> None:
async def add_external_output(self, txo: TxOutput, script_pubkey: bytes) -> None:
await super().add_external_output(txo, script_pubkey)
self._add_output(txo, script_pubkey)
@ -209,7 +203,7 @@ class CoinJoinApprover(Approver):
/ decimal_divisor
)
def _add_output(self, txo: TxAckOutputType, script_pubkey: bytes) -> None:
def _add_output(self, txo: TxOutput, script_pubkey: bytes) -> None:
# Assumption: CoinJoin outputs are grouped by amount. (If this assumption is
# not satisfied, then we will compute a lower coordinator fee, which may lead
# us to wrongfully decline the transaction.)

@ -22,11 +22,11 @@ if False:
from trezor.crypto import bip32
from trezor.messages.SignTx import SignTx
from trezor.messages.TxAckInputType import TxAckInputType
from trezor.messages.TxAckOutputType import TxAckOutputType
from trezor.messages.TxAckPrevTxType import TxAckPrevTxType
from trezor.messages.TxAckPrevInputType import TxAckPrevInputType
from trezor.messages.TxAckPrevOutputType import TxAckPrevOutputType
from trezor.messages.TxInput import TxInput
from trezor.messages.TxOutput import TxOutput
from trezor.messages.PrevTx import PrevTx
from trezor.messages.PrevInput import PrevInput
from trezor.messages.PrevOutput import PrevOutput
from apps.common.coininfo import CoinInfo
from apps.common.keychain import Keychain
@ -209,7 +209,7 @@ class Bitcoin:
self.write_tx_footer(self.serialized_tx, self.tx)
await helpers.request_tx_finish(self.tx_req)
async def process_internal_input(self, txi: TxAckInputType) -> None:
async def process_internal_input(self, txi: TxInput) -> None:
self.wallet_path.add_input(txi)
self.multisig_fingerprint.add_input(txi)
@ -218,10 +218,10 @@ class Bitcoin:
await self.approver.add_internal_input(txi)
async def process_external_input(self, txi: TxAckInputType) -> None:
async def process_external_input(self, txi: TxInput) -> None:
self.approver.add_external_input(txi)
async def approve_output(self, txo: TxAckOutputType, script_pubkey: bytes) -> None:
async def approve_output(self, txo: TxOutput, script_pubkey: bytes) -> None:
if self.output_is_change(txo):
# output is change and does not need approval
self.approver.add_change_output(txo, script_pubkey)
@ -234,7 +234,7 @@ class Bitcoin:
async def get_tx_digest(
self,
i: int,
txi: TxAckInputType,
txi: TxInput,
public_keys: List[bytes],
threshold: int,
script_pubkey: bytes,
@ -246,7 +246,7 @@ class Bitcoin:
return digest
async def verify_external_input(
self, i: int, txi: TxAckInputType, script_pubkey: bytes
self, i: int, txi: TxInput, script_pubkey: bytes
) -> None:
if txi.ownership_proof:
if not verify_nonownership(
@ -291,7 +291,7 @@ class Bitcoin:
script_sig = self.input_derive_script(txi, key_sign_pub, b"")
self.write_tx_input(self.serialized_tx, txi, script_sig)
def sign_bip143_input(self, txi: TxAckInputType) -> Tuple[bytes, bytes]:
def sign_bip143_input(self, txi: TxInput) -> Tuple[bytes, bytes]:
self.wallet_path.check_input(txi)
self.multisig_fingerprint.check_input(txi)
@ -335,7 +335,7 @@ class Bitcoin:
async def get_legacy_tx_digest(
self, index: int, script_pubkey: Optional[bytes] = None
) -> Tuple[bytes, TxAckInputType, Optional[bip32.HDNode]]:
) -> Tuple[bytes, TxInput, Optional[bip32.HDNode]]:
# the transaction digest which gets signed for this input
h_sign = self.create_hash_writer()
# should come out the same as h_approved, checked before signing the digest
@ -460,17 +460,17 @@ class Bitcoin:
return amount_out, script_pubkey
def check_prevtx_output(self, txo_bin: TxAckPrevOutputType) -> None:
def check_prevtx_output(self, txo_bin: PrevOutput) -> None:
# Validations to perform on the UTXO when checking the previous transaction output amount.
pass
# Tx Helpers
# ===
def get_sighash_type(self, txi: TxAckInputType) -> int:
def get_sighash_type(self, txi: TxInput) -> int:
return SIGHASH_ALL
def get_hash_type(self, txi: TxAckInputType) -> int:
def get_hash_type(self, txi: TxInput) -> int:
""" Return the nHashType flags."""
# The nHashType is the 8 least significant bits of the sighash type.
# Some coins set the 24 most significant bits of the sighash type to
@ -478,39 +478,28 @@ class Bitcoin:
return self.get_sighash_type(txi) & 0xFF
def write_tx_input(
self,
w: writers.Writer,
txi: Union[TxAckInputType, TxAckPrevInputType],
script: bytes,
self, w: writers.Writer, txi: Union[TxInput, PrevInput], script: bytes,
) -> None:
writers.write_tx_input(w, txi, script)
def write_tx_output(
self,
w: writers.Writer,
txo: Union[TxAckOutputType, TxAckPrevOutputType],
script_pubkey: bytes,
self, w: writers.Writer, txo: Union[TxOutput, PrevOutput], script_pubkey: bytes,
) -> None:
writers.write_tx_output(w, txo, script_pubkey)
def write_tx_header(
self,
w: writers.Writer,
tx: Union[SignTx, TxAckPrevTxType],
witness_marker: bool,
self, w: writers.Writer, tx: Union[SignTx, PrevTx], witness_marker: bool,
) -> None:
writers.write_uint32(w, tx.version) # nVersion
if witness_marker:
write_bitcoin_varint(w, 0x00) # segwit witness marker
write_bitcoin_varint(w, 0x01) # segwit witness flag
def write_tx_footer(
self, w: writers.Writer, tx: Union[SignTx, TxAckPrevTxType]
) -> None:
def write_tx_footer(self, w: writers.Writer, tx: Union[SignTx, PrevTx]) -> None:
writers.write_uint32(w, tx.lock_time)
async def write_prev_tx_footer(
self, w: writers.Writer, tx: TxAckPrevTxType, prev_hash: bytes
self, w: writers.Writer, tx: PrevTx, prev_hash: bytes
) -> None:
self.write_tx_footer(w, tx)
@ -525,7 +514,7 @@ class Bitcoin:
# Tx Outputs
# ===
def output_derive_script(self, txo: TxAckOutputType) -> bytes:
def output_derive_script(self, txo: TxOutput) -> bytes:
if txo.script_type == OutputScriptType.PAYTOOPRETURN:
assert txo.op_return_data is not None # checked in sanitize_tx_output
return scripts.output_script_paytoopreturn(txo.op_return_data)
@ -547,7 +536,7 @@ class Bitcoin:
return scripts.output_derive_script(txo.address, self.coin)
def output_is_change(self, txo: TxAckOutputType) -> bool:
def output_is_change(self, txo: TxOutput) -> bool:
if txo.script_type not in common.CHANGE_OUTPUT_SCRIPT_TYPES:
return False
if txo.multisig and not self.multisig_fingerprint.output_matches(txo):
@ -564,7 +553,7 @@ class Bitcoin:
# ===
def input_derive_script(
self, txi: TxAckInputType, pubkey: bytes, signature: bytes
self, txi: TxInput, pubkey: bytes, signature: bytes
) -> bytes:
return scripts.input_derive_script(
txi.script_type,
@ -583,18 +572,18 @@ class Bitcoin:
self.h_sequence = HashWriter(sha256())
self.h_outputs = HashWriter(sha256())
def hash143_add_input(self, txi: TxAckInputType) -> None:
def hash143_add_input(self, txi: TxInput) -> None:
writers.write_bytes_reversed(
self.h_prevouts, txi.prev_hash, writers.TX_HASH_SIZE
)
writers.write_uint32(self.h_prevouts, txi.prev_index)
writers.write_uint32(self.h_sequence, txi.sequence)
def hash143_add_output(self, txo: TxAckOutputType, script_pubkey: bytes) -> None:
def hash143_add_output(self, txo: TxOutput, script_pubkey: bytes) -> None:
writers.write_tx_output(self.h_outputs, txo, script_pubkey)
def hash143_preimage_hash(
self, txi: TxAckInputType, public_keys: List[bytes], threshold: int
self, txi: TxInput, public_keys: List[bytes], threshold: int
) -> bytes:
h_preimage = HashWriter(sha256())
@ -644,17 +633,17 @@ class Bitcoin:
return writers.get_tx_hash(h_preimage, double=self.coin.sign_hash_double)
def input_is_segwit(txi: TxAckInputType) -> bool:
def input_is_segwit(txi: TxInput) -> bool:
return txi.script_type in common.SEGWIT_INPUT_SCRIPT_TYPES or (
txi.script_type == InputScriptType.EXTERNAL and txi.witness is not None
)
def input_is_nonsegwit(txi: TxAckInputType) -> bool:
def input_is_nonsegwit(txi: TxInput) -> bool:
return txi.script_type in common.NONSEGWIT_INPUT_SCRIPT_TYPES or (
txi.script_type == InputScriptType.EXTERNAL and txi.witness is None
)
def input_is_external(txi: TxAckInputType) -> bool:
def input_is_external(txi: TxInput) -> bool:
return txi.script_type == InputScriptType.EXTERNAL

@ -1,9 +1,9 @@
from micropython import const
from trezor import wire
from trezor.messages.PrevTx import PrevTx
from trezor.messages.SignTx import SignTx
from trezor.messages.TxAckInputType import TxAckInputType
from trezor.messages.TxAckPrevTxType import TxAckPrevTxType
from trezor.messages.TxInput import TxInput
from apps.common.writers import write_bitcoin_varint
@ -43,7 +43,7 @@ class Bitcoinlike(Bitcoin):
async def get_tx_digest(
self,
i: int,
txi: TxAckInputType,
txi: TxInput,
public_keys: List[bytes],
threshold: int,
script_pubkey: bytes,
@ -55,17 +55,14 @@ class Bitcoinlike(Bitcoin):
i, txi, public_keys, threshold, script_pubkey
)
def get_sighash_type(self, txi: TxAckInputType) -> int:
def get_sighash_type(self, txi: TxInput) -> int:
hashtype = super().get_sighash_type(txi)
if self.coin.fork_id is not None:
hashtype |= (self.coin.fork_id << 8) | _SIGHASH_FORKID
return hashtype
def write_tx_header(
self,
w: writers.Writer,
tx: Union[SignTx, TxAckPrevTxType],
witness_marker: bool,
self, w: writers.Writer, tx: Union[SignTx, PrevTx], witness_marker: bool,
) -> None:
writers.write_uint32(w, tx.version) # nVersion
if self.coin.timestamp:
@ -76,7 +73,7 @@ class Bitcoinlike(Bitcoin):
write_bitcoin_varint(w, 0x01) # segwit witness flag
async def write_prev_tx_footer(
self, w: writers.Writer, tx: TxAckPrevTxType, prev_hash: bytes
self, w: writers.Writer, tx: PrevTx, prev_hash: bytes
) -> None:
await super().write_prev_tx_footer(w, tx, prev_hash)

@ -3,7 +3,7 @@ from micropython import const
from trezor import wire
from trezor.crypto.hashlib import blake256
from trezor.messages import InputScriptType
from trezor.messages.TxAckPrevOutputType import TxAckPrevOutputType
from trezor.messages.PrevOutput import PrevOutput
from trezor.utils import HashWriter, ensure
from apps.common.writers import write_bitcoin_varint
@ -24,10 +24,10 @@ if False:
from typing import Union
from trezor.messages.SignTx import SignTx
from trezor.messages.TxAckInputType import TxAckInputType
from trezor.messages.TxAckOutputType import TxAckOutputType
from trezor.messages.TxAckPrevTxType import TxAckPrevTxType
from trezor.messages.TxAckPrevInputType import TxAckPrevInputType
from trezor.messages.TxInput import TxInput
from trezor.messages.TxOutput import TxOutput
from trezor.messages.PrevTx import PrevTx
from trezor.messages.PrevInput import PrevInput
from apps.common.coininfo import CoinInfo
from apps.common.keychain import Keychain
@ -64,16 +64,16 @@ class Decred(Bitcoin):
self.write_tx_footer(self.serialized_tx, self.tx)
self.write_tx_footer(self.h_prefix, self.tx)
async def process_internal_input(self, txi: TxAckInputType) -> None:
async def process_internal_input(self, txi: TxInput) -> None:
await super().process_internal_input(txi)
# Decred serializes inputs early.
self.write_tx_input(self.serialized_tx, txi, bytes())
async def process_external_input(self, txi: TxAckInputType) -> None:
async def process_external_input(self, txi: TxInput) -> None:
raise wire.DataError("External inputs not supported")
async def approve_output(self, txo: TxAckOutputType, script_pubkey: bytes) -> None:
async def approve_output(self, txo: TxOutput, script_pubkey: bytes) -> None:
await super().approve_output(txo, script_pubkey)
self.write_tx_output(self.serialized_tx, txo, script_pubkey)
@ -144,21 +144,18 @@ class Decred(Bitcoin):
async def step7_finish(self) -> None:
await helpers.request_tx_finish(self.tx_req)
def check_prevtx_output(self, txo_bin: TxAckPrevOutputType) -> None:
def check_prevtx_output(self, txo_bin: PrevOutput) -> None:
if txo_bin.decred_script_version != 0:
raise wire.ProcessError("Cannot use utxo that has script_version != 0")
def hash143_add_input(self, txi: TxAckInputType) -> None:
def hash143_add_input(self, txi: TxInput) -> None:
self.write_tx_input(self.h_prefix, txi, bytes())
def hash143_add_output(self, txo: TxAckOutputType, script_pubkey: bytes) -> None:
def hash143_add_output(self, txo: TxOutput, script_pubkey: bytes) -> None:
self.write_tx_output(self.h_prefix, txo, script_pubkey)
def write_tx_input(
self,
w: writers.Writer,
txi: Union[TxAckInputType, TxAckPrevInputType],
script: bytes,
self, w: writers.Writer, txi: Union[TxInput, PrevInput], script: bytes,
) -> None:
writers.write_bytes_reversed(w, txi.prev_hash, writers.TX_HASH_SIZE)
writers.write_uint32(w, txi.prev_index or 0)
@ -166,13 +163,10 @@ class Decred(Bitcoin):
writers.write_uint32(w, txi.sequence)
def write_tx_output(
self,
w: writers.Writer,
txo: Union[TxAckOutputType, TxAckPrevOutputType],
script_pubkey: bytes,
self, w: writers.Writer, txo: Union[TxOutput, PrevOutput], script_pubkey: bytes,
) -> None:
writers.write_uint64(w, txo.amount)
if isinstance(txo, TxAckPrevOutputType):
if isinstance(txo, PrevOutput):
if txo.decred_script_version is None:
raise wire.DataError("Script version must be provided")
writers.write_uint16(w, txo.decred_script_version)
@ -181,10 +175,7 @@ class Decred(Bitcoin):
writers.write_bytes_prefixed(w, script_pubkey)
def write_tx_header(
self,
w: writers.Writer,
tx: Union[SignTx, TxAckPrevTxType],
witness_marker: bool,
self, w: writers.Writer, tx: Union[SignTx, PrevTx], witness_marker: bool,
) -> None:
# The upper 16 bits of the transaction version specify the serialization
# format and the lower 16 bits specify the version number.
@ -195,15 +186,13 @@ class Decred(Bitcoin):
writers.write_uint32(w, version)
def write_tx_footer(
self, w: writers.Writer, tx: Union[SignTx, TxAckPrevTxType]
) -> None:
def write_tx_footer(self, w: writers.Writer, tx: Union[SignTx, PrevTx]) -> None:
assert tx.expiry is not None # checked in sanitize_*
writers.write_uint32(w, tx.lock_time)
writers.write_uint32(w, tx.expiry)
def write_tx_input_witness(
self, w: writers.Writer, i: TxAckInputType, script_sig: bytes
self, w: writers.Writer, i: TxInput, script_sig: bytes
) -> None:
writers.write_uint64(w, i.amount)
writers.write_uint32(w, 0) # block height fraud proof

@ -1,5 +1,8 @@
from trezor import utils, wire
from trezor.messages import InputScriptType, OutputScriptType
from trezor.messages.PrevInput import PrevInput
from trezor.messages.PrevOutput import PrevOutput
from trezor.messages.PrevTx import PrevTx
from trezor.messages.RequestType import (
TXEXTRADATA,
TXFINISHED,
@ -9,16 +12,13 @@ from trezor.messages.RequestType import (
)
from trezor.messages.SignTx import SignTx
from trezor.messages.TxAckInput import TxAckInput
from trezor.messages.TxAckInputType import TxAckInputType
from trezor.messages.TxAckOutput import TxAckOutput
from trezor.messages.TxAckOutputType import TxAckOutputType
from trezor.messages.TxAckPrevExtraData import TxAckPrevExtraData
from trezor.messages.TxAckPrevInput import TxAckPrevInput
from trezor.messages.TxAckPrevInputType import TxAckPrevInputType
from trezor.messages.TxAckPrevMeta import TxAckPrevMeta
from trezor.messages.TxAckPrevOutput import TxAckPrevOutput
from trezor.messages.TxAckPrevOutputType import TxAckPrevOutputType
from trezor.messages.TxAckPrevTxType import TxAckPrevTxType
from trezor.messages.TxInput import TxInput
from trezor.messages.TxOutput import TxOutput
from trezor.messages.TxRequest import TxRequest
from apps.common import paths
@ -42,7 +42,7 @@ class UiConfirm:
class UiConfirmOutput(UiConfirm):
def __init__(self, output: TxAckOutputType, coin: CoinInfo):
def __init__(self, output: TxOutput, coin: CoinInfo):
self.output = output
self.coin = coin
@ -120,7 +120,7 @@ class UiConfirmNonDefaultLocktime(UiConfirm):
__eq__ = utils.obj_eq
def confirm_output(output: TxAckOutputType, coin: CoinInfo) -> Awaitable[None]: # type: ignore
def confirm_output(output: TxOutput, coin: CoinInfo) -> Awaitable[None]: # type: ignore
return (yield UiConfirmOutput(output, coin))
@ -148,7 +148,7 @@ def confirm_nondefault_locktime(lock_time: int, lock_time_disabled: bool) -> Awa
return (yield UiConfirmNonDefaultLocktime(lock_time, lock_time_disabled))
def request_tx_meta(tx_req: TxRequest, coin: CoinInfo, tx_hash: bytes = None) -> Awaitable[TxAckPrevTxType]: # type: ignore
def request_tx_meta(tx_req: TxRequest, coin: CoinInfo, tx_hash: bytes = None) -> Awaitable[PrevTx]: # type: ignore
assert tx_req.details is not None
tx_req.request_type = TXMETA
tx_req.details.tx_hash = tx_hash
@ -170,7 +170,7 @@ def request_tx_extra_data( # type: ignore
return ack.tx.extra_data_chunk
def request_tx_input(tx_req: TxRequest, i: int, coin: CoinInfo) -> Awaitable[TxAckInputType]: # type: ignore
def request_tx_input(tx_req: TxRequest, i: int, coin: CoinInfo) -> Awaitable[TxInput]: # type: ignore
assert tx_req.details is not None
tx_req.request_type = TXINPUT
tx_req.details.request_index = i
@ -179,7 +179,7 @@ def request_tx_input(tx_req: TxRequest, i: int, coin: CoinInfo) -> Awaitable[TxA
return sanitize_tx_input(ack.tx.input, coin)
def request_tx_prev_input(tx_req: TxRequest, i: int, coin: CoinInfo, tx_hash: bytes = None) -> Awaitable[TxAckPrevInputType]: # type: ignore
def request_tx_prev_input(tx_req: TxRequest, i: int, coin: CoinInfo, tx_hash: bytes = None) -> Awaitable[PrevInput]: # type: ignore
assert tx_req.details is not None
tx_req.request_type = TXINPUT
tx_req.details.request_index = i
@ -189,7 +189,7 @@ def request_tx_prev_input(tx_req: TxRequest, i: int, coin: CoinInfo, tx_hash: by
return sanitize_tx_prev_input(ack.tx.input, coin)
def request_tx_output(tx_req: TxRequest, i: int, coin: CoinInfo) -> Awaitable[TxAckOutputType]: # type: ignore
def request_tx_output(tx_req: TxRequest, i: int, coin: CoinInfo) -> Awaitable[TxOutput]: # type: ignore
assert tx_req.details is not None
tx_req.request_type = TXOUTPUT
tx_req.details.request_index = i
@ -198,7 +198,7 @@ def request_tx_output(tx_req: TxRequest, i: int, coin: CoinInfo) -> Awaitable[Tx
return sanitize_tx_output(ack.tx.output, coin)
def request_tx_prev_output(tx_req: TxRequest, i: int, coin: CoinInfo, tx_hash: bytes = None) -> Awaitable[TxAckPrevOutputType]: # type: ignore
def request_tx_prev_output(tx_req: TxRequest, i: int, coin: CoinInfo, tx_hash: bytes = None) -> Awaitable[PrevOutput]: # type: ignore
assert tx_req.details is not None
tx_req.request_type = TXOUTPUT
tx_req.details.request_index = i
@ -256,7 +256,7 @@ def sanitize_sign_tx(tx: SignTx, coin: CoinInfo) -> SignTx:
return tx
def sanitize_tx_meta(tx: TxAckPrevTxType, coin: CoinInfo) -> TxAckPrevTxType:
def sanitize_tx_meta(tx: PrevTx, coin: CoinInfo) -> PrevTx:
if not coin.extra_data and tx.extra_data_len:
raise wire.DataError("Extra data not enabled on this coin.")
if coin.decred or coin.overwintered:
@ -275,7 +275,7 @@ def sanitize_tx_meta(tx: TxAckPrevTxType, coin: CoinInfo) -> TxAckPrevTxType:
return tx
def sanitize_tx_input(txi: TxAckInputType, coin: CoinInfo) -> TxAckInputType:
def sanitize_tx_input(txi: TxInput, coin: CoinInfo) -> TxInput:
if len(txi.prev_hash) != TX_HASH_SIZE:
raise wire.DataError("Provided prev_hash is invalid.")
if txi.multisig and txi.script_type not in common.MULTISIG_INPUT_SCRIPT_TYPES:
@ -294,9 +294,7 @@ def sanitize_tx_input(txi: TxAckInputType, coin: CoinInfo) -> TxAckInputType:
return txi
def sanitize_tx_prev_input(
txi: TxAckPrevInputType, coin: CoinInfo
) -> TxAckPrevInputType:
def sanitize_tx_prev_input(txi: PrevInput, coin: CoinInfo) -> PrevInput:
if len(txi.prev_hash) != TX_HASH_SIZE:
raise wire.DataError("Provided prev_hash is invalid.")
if not coin.decred and txi.decred_tree is not None:
@ -304,7 +302,7 @@ def sanitize_tx_prev_input(
return txi
def sanitize_tx_output(txo: TxAckOutputType, coin: CoinInfo) -> TxAckOutputType:
def sanitize_tx_output(txo: TxOutput, coin: CoinInfo) -> TxOutput:
if txo.multisig and txo.script_type not in common.MULTISIG_OUTPUT_SCRIPT_TYPES:
raise wire.DataError("Multisig field provided but not expected.")
if txo.address_n and txo.script_type not in common.CHANGE_OUTPUT_SCRIPT_TYPES:

@ -15,7 +15,7 @@ from . import omni
if False:
from typing import Iterator
from trezor import wire
from trezor.messages.TxAckOutputType import TxAckOutputType
from trezor.messages.TxOutput import TxOutput
from apps.common.coininfo import CoinInfo
@ -34,9 +34,7 @@ def split_op_return(data: str) -> Iterator[str]:
return chunks(data, 18)
async def confirm_output(
ctx: wire.Context, output: TxAckOutputType, coin: CoinInfo
) -> None:
async def confirm_output(ctx: wire.Context, output: TxOutput, coin: CoinInfo) -> None:
if output.script_type == OutputScriptType.PAYTOOPRETURN:
data = output.op_return_data
assert data is not None

@ -7,8 +7,8 @@ from ..common import BIP32_WALLET_DEPTH
if False:
from typing import Any, Union, Generic, TypeVar
from trezor.messages.TxAckInputType import TxAckInputType
from trezor.messages.TxAckOutputType import TxAckOutputType
from trezor.messages.TxInput import TxInput
from trezor.messages.TxOutput import TxOutput
T = TypeVar("T")
else:
@ -46,13 +46,13 @@ class MatchChecker(Generic[T]):
self.attribute = self.UNDEFINED # type: Union[object, T]
self.read_only = False # Failsafe to ensure that add_input() is not accidentally called after output_matches().
def attribute_from_tx(self, txio: Union[TxAckInputType, TxAckOutputType]) -> T:
def attribute_from_tx(self, txio: Union[TxInput, TxOutput]) -> T:
# Return the attribute from the txio, which is to be used for matching.
# If the txio is invalid for matching, then return an object which
# evaluates as a boolean False.
raise NotImplementedError
def add_input(self, txi: TxAckInputType) -> None:
def add_input(self, txi: TxInput) -> None:
ensure(not self.read_only)
if self.attribute is self.MISMATCH:
@ -66,7 +66,7 @@ class MatchChecker(Generic[T]):
elif self.attribute != added_attribute:
self.attribute = self.MISMATCH
def check_input(self, txi: TxAckInputType) -> None:
def check_input(self, txi: TxInput) -> None:
if self.attribute is self.MISMATCH:
return # There was already a mismatch when adding inputs, ignore it now.
@ -75,7 +75,7 @@ class MatchChecker(Generic[T]):
if self.attribute != self.attribute_from_tx(txi):
raise wire.ProcessError("Transaction has changed during signing")
def output_matches(self, txo: TxAckOutputType) -> bool:
def output_matches(self, txo: TxOutput) -> bool:
self.read_only = True
if self.attribute is self.MISMATCH:
@ -85,14 +85,14 @@ class MatchChecker(Generic[T]):
class WalletPathChecker(MatchChecker):
def attribute_from_tx(self, txio: Union[TxAckInputType, TxAckOutputType]) -> Any:
def attribute_from_tx(self, txio: Union[TxInput, TxOutput]) -> Any:
if len(txio.address_n) < BIP32_WALLET_DEPTH:
return None
return txio.address_n[:-BIP32_WALLET_DEPTH]
class MultisigFingerprintChecker(MatchChecker):
def attribute_from_tx(self, txio: Union[TxAckInputType, TxAckOutputType]) -> Any:
def attribute_from_tx(self, txio: Union[TxInput, TxOutput]) -> Any:
if not txio.multisig:
return None
return multisig.multisig_fingerprint(txio.multisig)

@ -10,7 +10,7 @@ from micropython import const
from trezor.messages import InputScriptType
if False:
from trezor.messages.TxAckInputType import TxAckInputType
from trezor.messages.TxInput import TxInput
# transaction header size: 4 byte version
_TXSIZE_HEADER = const(4)
@ -52,7 +52,7 @@ class TxWeightCalculator:
self.counter += self.ser_length_size(self.inputs_count)
self.segwit = True
def add_input(self, i: TxAckInputType) -> None:
def add_input(self, i: TxInput) -> None:
if i.multisig:
multisig_script_size = _TXSIZE_MULTISIGSCRIPT + len(i.multisig.pubkeys) * (

@ -4,9 +4,9 @@ from micropython import const
from trezor import wire
from trezor.crypto.hashlib import blake2b
from trezor.messages import InputScriptType
from trezor.messages.PrevTx import PrevTx
from trezor.messages.SignTx import SignTx
from trezor.messages.TxAckInputType import TxAckInputType
from trezor.messages.TxAckPrevTxType import TxAckPrevTxType
from trezor.messages.TxInput import TxInput
from trezor.utils import HashWriter, ensure
from apps.common.coininfo import CoinInfo
@ -64,7 +64,7 @@ class Zcashlike(Bitcoinlike):
async def get_tx_digest(
self,
i: int,
txi: TxAckInputType,
txi: TxInput,
public_keys: List[bytes],
threshold: int,
script_pubkey: bytes,
@ -72,7 +72,7 @@ class Zcashlike(Bitcoinlike):
return self.hash143_preimage_hash(txi, public_keys, threshold)
def write_tx_header(
self, w: Writer, tx: Union[SignTx, TxAckPrevTxType], witness_marker: bool
self, w: Writer, tx: Union[SignTx, PrevTx], witness_marker: bool
) -> None:
if tx.version < 3:
# pre-overwinter
@ -84,7 +84,7 @@ class Zcashlike(Bitcoinlike):
write_uint32(w, tx.version | OVERWINTERED)
write_uint32(w, tx.version_group_id) # nVersionGroupId
def write_tx_footer(self, w: Writer, tx: Union[SignTx, TxAckPrevTxType]) -> None:
def write_tx_footer(self, w: Writer, tx: Union[SignTx, PrevTx]) -> None:
assert tx.expiry is not None # checked in sanitize_*
write_uint32(w, tx.lock_time)
if tx.version >= 3:
@ -99,7 +99,7 @@ class Zcashlike(Bitcoinlike):
self.h_outputs = HashWriter(blake2b(outlen=32, personal=b"ZcashOutputsHash"))
def hash143_preimage_hash(
self, txi: TxAckInputType, public_keys: List[bytes], threshold: int
self, txi: TxInput, public_keys: List[bytes], threshold: int
) -> bytes:
h_preimage = HashWriter(
blake2b(
@ -156,7 +156,7 @@ class Zcashlike(Bitcoinlike):
def derive_script_code(
txi: TxAckInputType, public_keys: List[bytes], threshold: int, coin: CoinInfo
txi: TxInput, public_keys: List[bytes], threshold: int, coin: CoinInfo
) -> bytearray:
if len(public_keys) > 1:
return output_script_multisig(public_keys, threshold)

@ -18,10 +18,10 @@ from apps.common.writers import ( # noqa: F401
if False:
from typing import Union
from trezor.messages.TxAckInputType import TxAckInputType
from trezor.messages.TxAckOutputType import TxAckOutputType
from trezor.messages.TxAckPrevInputType import TxAckPrevInputType
from trezor.messages.TxAckPrevOutputType import TxAckPrevOutputType
from trezor.messages.TxInput import TxInput
from trezor.messages.TxOutput import TxOutput
from trezor.messages.PrevInput import PrevInput
from trezor.messages.PrevOutput import PrevOutput
from trezor.utils import HashWriter
from apps.common.writers import Writer
@ -38,16 +38,14 @@ def write_bytes_prefixed(w: Writer, b: bytes) -> None:
write_bytes_unchecked(w, b)
def write_tx_input(
w: Writer, i: Union[TxAckInputType, TxAckPrevInputType], script: bytes,
) -> None:
def write_tx_input(w: Writer, i: Union[TxInput, PrevInput], script: bytes,) -> None:
write_bytes_reversed(w, i.prev_hash, TX_HASH_SIZE)
write_uint32(w, i.prev_index)
write_bytes_prefixed(w, script)
write_uint32(w, i.sequence)
def write_tx_input_check(w: Writer, i: TxAckInputType) -> None:
def write_tx_input_check(w: Writer, i: TxInput) -> None:
write_bytes_fixed(w, i.prev_hash, TX_HASH_SIZE)
write_uint32(w, i.prev_index)
write_uint32(w, i.script_type)
@ -59,7 +57,7 @@ def write_tx_input_check(w: Writer, i: TxAckInputType) -> None:
def write_tx_output(
w: Writer, o: Union[TxAckOutputType, TxAckPrevOutputType], script_pubkey: bytes
w: Writer, o: Union[TxOutput, PrevOutput], script_pubkey: bytes
) -> None:
write_uint64(w, o.amount)
write_bytes_prefixed(w, script_pubkey)

@ -10,7 +10,7 @@ if __debug__:
pass
class TxAckPrevInputType(p.MessageType):
class PrevInput(p.MessageType):
def __init__(
self,

@ -10,7 +10,7 @@ if __debug__:
pass
class TxAckPrevOutputType(p.MessageType):
class PrevOutput(p.MessageType):
def __init__(
self,

@ -10,7 +10,7 @@ if __debug__:
pass
class TxAckPrevTxType(p.MessageType):
class PrevTx(p.MessageType):
def __init__(
self,

@ -2,7 +2,7 @@
# fmt: off
import protobuf as p
from .TxAckInputType import TxAckInputType
from .TxInput import TxInput
if __debug__:
try:
@ -17,12 +17,12 @@ class TxAckInputWrapper(p.MessageType):
def __init__(
self,
*,
input: TxAckInputType,
input: TxInput,
) -> None:
self.input = input
@classmethod
def get_fields(cls) -> Dict:
return {
2: ('input', TxAckInputType, p.FLAG_REQUIRED),
2: ('input', TxInput, p.FLAG_REQUIRED),
}

@ -2,7 +2,7 @@
# fmt: off
import protobuf as p
from .TxAckOutputType import TxAckOutputType
from .TxOutput import TxOutput
if __debug__:
try:
@ -17,12 +17,12 @@ class TxAckOutputWrapper(p.MessageType):
def __init__(
self,
*,
output: TxAckOutputType,
output: TxOutput,
) -> None:
self.output = output
@classmethod
def get_fields(cls) -> Dict:
return {
5: ('output', TxAckOutputType, p.FLAG_REQUIRED),
5: ('output', TxOutput, p.FLAG_REQUIRED),
}

@ -2,7 +2,7 @@
# fmt: off
import protobuf as p
from .TxAckPrevInputType import TxAckPrevInputType
from .PrevInput import PrevInput
if __debug__:
try:
@ -17,12 +17,12 @@ class TxAckPrevInputWrapper(p.MessageType):
def __init__(
self,
*,
input: TxAckPrevInputType,
input: PrevInput,
) -> None:
self.input = input
@classmethod
def get_fields(cls) -> Dict:
return {
2: ('input', TxAckPrevInputType, p.FLAG_REQUIRED),
2: ('input', PrevInput, p.FLAG_REQUIRED),
}

@ -2,7 +2,7 @@
# fmt: off
import protobuf as p
from .TxAckPrevTxType import TxAckPrevTxType
from .PrevTx import PrevTx
if __debug__:
try:
@ -18,12 +18,12 @@ class TxAckPrevMeta(p.MessageType):
def __init__(
self,
*,
tx: TxAckPrevTxType,
tx: PrevTx,
) -> None:
self.tx = tx
@classmethod
def get_fields(cls) -> Dict:
return {
1: ('tx', TxAckPrevTxType, p.FLAG_REQUIRED),
1: ('tx', PrevTx, p.FLAG_REQUIRED),
}

@ -2,7 +2,7 @@
# fmt: off
import protobuf as p
from .TxAckPrevOutputType import TxAckPrevOutputType
from .PrevOutput import PrevOutput
if __debug__:
try:
@ -17,12 +17,12 @@ class TxAckPrevOutputWrapper(p.MessageType):
def __init__(
self,
*,
output: TxAckPrevOutputType,
output: PrevOutput,
) -> None:
self.output = output
@classmethod
def get_fields(cls) -> Dict:
return {
3: ('output', TxAckPrevOutputType, p.FLAG_REQUIRED),
3: ('output', PrevOutput, p.FLAG_REQUIRED),
}

@ -13,7 +13,7 @@ if __debug__:
pass
class TxAckInputType(p.MessageType):
class TxInput(p.MessageType):
def __init__(
self,

@ -13,7 +13,7 @@ if __debug__:
pass
class TxAckOutputType(p.MessageType):
class TxOutput(p.MessageType):
def __init__(
self,

@ -2,8 +2,8 @@ from common import unittest, await_result, H_
from trezor import wire
from trezor.messages.AuthorizeCoinJoin import AuthorizeCoinJoin
from trezor.messages.TxAckInputType import TxAckInputType
from trezor.messages.TxAckOutputType import TxAckOutputType
from trezor.messages.TxInput import TxInput
from trezor.messages.TxOutput import TxOutput
from trezor.messages.SignTx import SignTx
from trezor.messages import InputScriptType, OutputScriptType
@ -32,7 +32,7 @@ class TestApprover(unittest.TestCase):
# Other's inputs.
inputs = [
TxAckInputType(
TxInput(
prev_hash=b"",
prev_index=0,
amount=denomination + 1000000 * (i + 1),
@ -44,7 +44,7 @@ class TestApprover(unittest.TestCase):
# Our input.
inputs.insert(
30,
TxAckInputType(
TxInput(
prev_hash=b"",
prev_index=0,
address_n=[H_(84), H_(0), H_(0), 0, 1],
@ -56,7 +56,7 @@ class TestApprover(unittest.TestCase):
# Other's CoinJoined outputs.
outputs = [
TxAckOutputType(
TxOutput(
amount=denomination,
script_type=OutputScriptType.PAYTOWITNESS,
) for i in range(99)
@ -65,7 +65,7 @@ class TestApprover(unittest.TestCase):
# Our CoinJoined output.
outputs.insert(
40,
TxAckOutputType(
TxOutput(
address_n=[H_(84), H_(0), H_(0), 0, 2],
amount=denomination,
script_type=OutputScriptType.PAYTOWITNESS,
@ -78,7 +78,7 @@ class TestApprover(unittest.TestCase):
# Other's change-outputs.
outputs.extend(
TxAckOutputType(
TxOutput(
amount=1000000 * (i + 1) - fees,
script_type=OutputScriptType.PAYTOWITNESS,
) for i in range(99)
@ -86,7 +86,7 @@ class TestApprover(unittest.TestCase):
# Our change-output.
outputs.append(
TxAckOutputType(
TxOutput(
address_n=[H_(84), H_(0), H_(0), 1, 1],
amount=1000000 - fees,
script_type=OutputScriptType.PAYTOWITNESS,
@ -95,7 +95,7 @@ class TestApprover(unittest.TestCase):
# Coordinator's output.
outputs.append(
TxAckOutputType(
TxOutput(
amount=total_coordinator_fee,
script_type=OutputScriptType.PAYTOWITNESS,
)
@ -124,7 +124,7 @@ class TestApprover(unittest.TestCase):
tx = SignTx(outputs_count=201, inputs_count=100, coin_name=self.coin.coin_name, lock_time=0)
approver = CoinJoinApprover(tx, self.coin, authorization)
txi = TxAckInputType(
txi = TxInput(
prev_hash=b"",
prev_index=0,
address_n=[H_(49), H_(0), H_(0), 0],
@ -140,7 +140,7 @@ class TestApprover(unittest.TestCase):
tx = SignTx(outputs_count=201, inputs_count=100, coin_name=self.coin.coin_name, lock_time=0)
approver = CoinJoinApprover(tx, self.coin, authorization)
txi = TxAckInputType(
txi = TxInput(
prev_hash=b"",
prev_index=0,
address_n=[H_(49), H_(0), H_(0), 0, 2],

@ -7,9 +7,9 @@ from apps.bitcoin.writers import get_tx_hash
from apps.common import coins
from apps.common.keychain import Keychain
from trezor.messages.SignTx import SignTx
from trezor.messages.TxAckInputType import TxAckInputType
from trezor.messages.TxAckOutputType import TxAckOutputType
from trezor.messages.TxAckPrevOutputType import TxAckPrevOutputType
from trezor.messages.TxInput import TxInput
from trezor.messages.TxOutput import TxOutput
from trezor.messages.PrevOutput import PrevOutput
from trezor.messages import InputScriptType
from trezor.messages import OutputScriptType
from trezor.crypto import bip39
@ -19,7 +19,7 @@ class TestSegwitBip143NativeP2WPKH(unittest.TestCase):
# pylint: disable=C0301
tx = SignTx(coin_name='Bitcoin', version=1, lock_time=0x00000011, inputs_count=2, outputs_count=2)
inp1 = TxAckInputType(address_n=[0],
inp1 = TxInput(address_n=[0],
# Trezor expects hash in reversed format
prev_hash=unhexlify('9f96ade4b41d5433f4eda31e1738ec2b36f6e7d1420d94a6af99801a88f7f7ff'),
prev_index=0,
@ -27,7 +27,7 @@ class TestSegwitBip143NativeP2WPKH(unittest.TestCase):
script_type=InputScriptType.SPENDWITNESS,
multisig=None,
sequence=0xffffffee)
inp2 = TxAckInputType(address_n=[1],
inp2 = TxInput(address_n=[1],
# Trezor expects hash in reversed format
prev_hash=unhexlify('8ac60eb9575db5b2d987e29f301b5b819ea83a5c6579d282d189cc04b8e151ef'),
prev_index=1,
@ -35,12 +35,12 @@ class TestSegwitBip143NativeP2WPKH(unittest.TestCase):
amount=600000000, # 6 btc
script_type=InputScriptType.SPENDWITNESS,
sequence=0xffffffff)
out1 = TxAckOutputType(address='1Cu32FVupVCgHkMMRJdYJugxwo2Aprgk7H', # derived
out1 = TxOutput(address='1Cu32FVupVCgHkMMRJdYJugxwo2Aprgk7H', # derived
amount=0x0000000006b22c20,
script_type=OutputScriptType.PAYTOADDRESS,
multisig=None,
address_n=[])
out2 = TxAckOutputType(address='16TZ8J6Q5iZKBWizWzFAYnrsaox5Z5aBRV', # derived
out2 = TxOutput(address='16TZ8J6Q5iZKBWizWzFAYnrsaox5Z5aBRV', # derived
amount=0x000000000d519390,
script_type=OutputScriptType.PAYTOADDRESS,
multisig=None,
@ -70,7 +70,7 @@ class TestSegwitBip143NativeP2WPKH(unittest.TestCase):
for txo in [self.out1, self.out2]:
script_pubkey = output_derive_script(txo.address, coin)
txo_bin = TxAckPrevOutputType(amount=txo.amount, script_pubkey=script_pubkey)
txo_bin = PrevOutput(amount=txo.amount, script_pubkey=script_pubkey)
bip143.hash143_add_output(txo_bin, script_pubkey)
outputs_hash = get_tx_hash(bip143.h_outputs, double=coin.sign_hash_double)
@ -86,7 +86,7 @@ class TestSegwitBip143NativeP2WPKH(unittest.TestCase):
for txo in [self.out1, self.out2]:
script_pubkey = output_derive_script(txo.address, coin)
txo_bin = TxAckPrevOutputType(amount=txo.amount, script_pubkey=script_pubkey)
txo_bin = PrevOutput(amount=txo.amount, script_pubkey=script_pubkey)
bip143.hash143_add_output(txo_bin, script_pubkey)
keychain = Keychain(seed, coin.curve_name, [[]])

@ -7,9 +7,9 @@ from apps.bitcoin.writers import get_tx_hash
from apps.common import coins
from apps.common.keychain import Keychain
from trezor.messages.SignTx import SignTx
from trezor.messages.TxAckInputType import TxAckInputType
from trezor.messages.TxAckOutputType import TxAckOutputType
from trezor.messages.TxAckPrevOutputType import TxAckPrevOutputType
from trezor.messages.TxInput import TxInput
from trezor.messages.TxOutput import TxOutput
from trezor.messages.PrevOutput import PrevOutput
from trezor.messages import InputScriptType
from trezor.messages import OutputScriptType
from trezor.crypto import bip39
@ -19,7 +19,7 @@ class TestSegwitBip143(unittest.TestCase):
# pylint: disable=C0301
tx = SignTx(coin_name='Bitcoin', version=1, lock_time=0x00000492, inputs_count=1, outputs_count=2)
inp1 = TxAckInputType(address_n=[0],
inp1 = TxInput(address_n=[0],
# Trezor expects hash in reversed format
prev_hash=unhexlify('77541aeb3c4dac9260b68f74f44c973081a9d4cb2ebe8038b2d70faa201b6bdb'),
prev_index=1,
@ -27,12 +27,12 @@ class TestSegwitBip143(unittest.TestCase):
amount=1000000000, # 10 btc
script_type=InputScriptType.SPENDP2SHWITNESS, # TODO: is this correct?
sequence=0xfffffffe)
out1 = TxAckOutputType(address='1Fyxts6r24DpEieygQiNnWxUdb18ANa5p7',
out1 = TxOutput(address='1Fyxts6r24DpEieygQiNnWxUdb18ANa5p7',
amount=0x000000000bebb4b8,
script_type=OutputScriptType.PAYTOADDRESS,
multisig=None,
address_n=[])
out2 = TxAckOutputType(address='1Q5YjKVj5yQWHBBsyEBamkfph3cA6G9KK8',
out2 = TxOutput(address='1Q5YjKVj5yQWHBBsyEBamkfph3cA6G9KK8',
amount=0x000000002faf0800,
script_type=OutputScriptType.PAYTOADDRESS,
multisig=None,
@ -59,7 +59,7 @@ class TestSegwitBip143(unittest.TestCase):
for txo in [self.out1, self.out2]:
script_pubkey = output_derive_script(txo.address, coin)
txo_bin = TxAckPrevOutputType(amount=txo.amount, script_pubkey=script_pubkey)
txo_bin = PrevOutput(amount=txo.amount, script_pubkey=script_pubkey)
bip143.hash143_add_output(txo_bin, script_pubkey)
outputs_hash = get_tx_hash(bip143.h_outputs, double=coin.sign_hash_double)
@ -72,7 +72,7 @@ class TestSegwitBip143(unittest.TestCase):
bip143.hash143_add_input(self.inp1)
for txo in [self.out1, self.out2]:
script_pubkey = output_derive_script(txo.address, coin)
txo_bin = TxAckPrevOutputType(amount=txo.amount, script_pubkey=script_pubkey)
txo_bin = PrevOutput(amount=txo.amount, script_pubkey=script_pubkey)
bip143.hash143_add_output(txo_bin, script_pubkey)
keychain = Keychain(seed, coin.curve_name, [[]])

@ -5,18 +5,18 @@ from trezor.crypto import bip39
from trezor.messages.SignTx import SignTx
from trezor.messages.TxAckInput import TxAckInput
from trezor.messages.TxAckInputWrapper import TxAckInputWrapper
from trezor.messages.TxAckInputType import TxAckInputType
from trezor.messages.TxInput import TxInput
from trezor.messages.TxAckOutput import TxAckOutput
from trezor.messages.TxAckOutputWrapper import TxAckOutputWrapper
from trezor.messages.TxAckOutputType import TxAckOutputType
from trezor.messages.TxOutput import TxOutput
from trezor.messages.TxAckPrevMeta import TxAckPrevMeta
from trezor.messages.TxAckPrevTxType import TxAckPrevTxType
from trezor.messages.PrevTx import PrevTx
from trezor.messages.TxAckPrevInput import TxAckPrevInput
from trezor.messages.TxAckPrevInputWrapper import TxAckPrevInputWrapper
from trezor.messages.TxAckPrevInputType import TxAckPrevInputType
from trezor.messages.PrevInput import PrevInput
from trezor.messages.TxAckPrevOutput import TxAckPrevOutput
from trezor.messages.TxAckPrevOutputWrapper import TxAckPrevOutputWrapper
from trezor.messages.TxAckPrevOutputType import TxAckPrevOutputType
from trezor.messages.PrevOutput import PrevOutput
from trezor.messages.TxRequest import TxRequest
from trezor.messages.RequestType import TXINPUT, TXMETA, TXOUTPUT, TXFINISHED
from trezor.messages.TxRequestDetailsType import TxRequestDetailsType
@ -43,7 +43,7 @@ class TestSignSegwitTxNativeP2WPKH(unittest.TestCase):
coin = coins.by_name('Testnet')
seed = bip39.seed(' '.join(['all'] * 12), '')
inp1 = TxAckInputType(
inp1 = TxInput(
# 49'/1'/0'/0/0" - tb1qqzv60m9ajw8drqulta4ld4gfx0rdh82un5s65s
address_n=[49 | 0x80000000, 1 | 0x80000000, 0 | 0x80000000, 0, 0],
amount=12300000,
@ -53,24 +53,24 @@ class TestSignSegwitTxNativeP2WPKH(unittest.TestCase):
sequence=0xffffffff,
multisig=None,
)
ptx1 = TxAckPrevTxType(version=1, lock_time=0, inputs_count=1, outputs_count=2, extra_data_len=0)
pinp1 = TxAckPrevInputType(script_sig=unhexlify('160014d16b8c0680c61fc6ed2e407455715055e41052f5'),
ptx1 = PrevTx(version=1, lock_time=0, inputs_count=1, outputs_count=2, extra_data_len=0)
pinp1 = PrevInput(script_sig=unhexlify('160014d16b8c0680c61fc6ed2e407455715055e41052f5'),
prev_hash=unhexlify('20912f98ea3ed849042efed0fdac8cb4fc301961c5988cba56902d8ffb61c337'),
prev_index=0,
sequence=4294967295)
pout1 = TxAckPrevOutputType(script_pubkey=unhexlify('00140099a7ecbd938ed1839f5f6bf6d50933c6db9d5c'),
pout1 = PrevOutput(script_pubkey=unhexlify('00140099a7ecbd938ed1839f5f6bf6d50933c6db9d5c'),
amount=12300000)
pout2 = TxAckPrevOutputType(script_pubkey=unhexlify('a91458b53ea7f832e8f096e896b8713a8c6df0e892ca87'),
pout2 = PrevOutput(script_pubkey=unhexlify('a91458b53ea7f832e8f096e896b8713a8c6df0e892ca87'),
amount=111145789)
out1 = TxAckOutputType(
out1 = TxOutput(
address='2N4Q5FhU2497BryFfUgbqkAJE87aKHUhXMp',
amount=5000000,
script_type=OutputScriptType.PAYTOADDRESS,
address_n=[],
multisig=None,
)
out2 = TxAckOutputType(
out2 = TxOutput(
address='tb1q694ccp5qcc0udmfwgp692u2s2hjpq5h407urtu',
script_type=OutputScriptType.PAYTOADDRESS,
amount=12300000 - 11000 - 5000000,
@ -174,7 +174,7 @@ class TestSignSegwitTxNativeP2WPKH(unittest.TestCase):
coin = coins.by_name('Testnet')
seed = bip39.seed(' '.join(['all'] * 12), '')
inp1 = TxAckInputType(
inp1 = TxInput(
# 49'/1'/0'/0/0" - tb1qqzv60m9ajw8drqulta4ld4gfx0rdh82un5s65s
address_n=[49 | 0x80000000, 1 | 0x80000000, 0 | 0x80000000, 0, 0],
amount=12300000,
@ -184,24 +184,24 @@ class TestSignSegwitTxNativeP2WPKH(unittest.TestCase):
sequence=0xffffffff,
multisig=None,
)
ptx1 = TxAckPrevTxType(version=1, lock_time=0, inputs_count=1, outputs_count=2, extra_data_len=0)
pinp1 = TxAckPrevInputType(script_sig=unhexlify('160014d16b8c0680c61fc6ed2e407455715055e41052f5'),
ptx1 = PrevTx(version=1, lock_time=0, inputs_count=1, outputs_count=2, extra_data_len=0)
pinp1 = PrevInput(script_sig=unhexlify('160014d16b8c0680c61fc6ed2e407455715055e41052f5'),
prev_hash=unhexlify('20912f98ea3ed849042efed0fdac8cb4fc301961c5988cba56902d8ffb61c337'),
prev_index=0,
sequence=4294967295)
pout1 = TxAckPrevOutputType(script_pubkey=unhexlify('00140099a7ecbd938ed1839f5f6bf6d50933c6db9d5c'),
pout1 = PrevOutput(script_pubkey=unhexlify('00140099a7ecbd938ed1839f5f6bf6d50933c6db9d5c'),
amount=12300000)
pout2 = TxAckPrevOutputType(script_pubkey=unhexlify('a91458b53ea7f832e8f096e896b8713a8c6df0e892ca87'),
pout2 = PrevOutput(script_pubkey=unhexlify('a91458b53ea7f832e8f096e896b8713a8c6df0e892ca87'),
amount=111145789)
out1 = TxAckOutputType(
out1 = TxOutput(
address='2N4Q5FhU2497BryFfUgbqkAJE87aKHUhXMp',
amount=5000000,
script_type=OutputScriptType.PAYTOADDRESS,
address_n=[],
multisig=None,
)
out2 = TxAckOutputType(
out2 = TxOutput(
address=None,
address_n=[49 | 0x80000000, 1 | 0x80000000, 0 | 0x80000000, 1, 0],
script_type=OutputScriptType.PAYTOWITNESS,
@ -260,7 +260,7 @@ class TestSignSegwitTxNativeP2WPKH(unittest.TestCase):
serialized_tx=unhexlify('8a44999c07bba32df1cacdc50987944e68e3205b4429438fdde35c76024614090000000000ffffffff02'),
)),
# the out has to be cloned not to send the same object which was modified
TxAckOutput(tx=TxAckOutputWrapper(output=TxAckOutputType(**out1.__dict__))),
TxAckOutput(tx=TxAckOutputWrapper(output=TxOutput(**out1.__dict__))),
TxRequest(request_type=TXOUTPUT, details=TxRequestDetailsType(request_index=1, tx_hash=None), serialized=TxRequestSerializedType(
# returned serialized out1
@ -268,7 +268,7 @@ class TestSignSegwitTxNativeP2WPKH(unittest.TestCase):
signature_index=None,
signature=None,
)),
TxAckOutput(tx=TxAckOutputWrapper(output=TxAckOutputType(**out2.__dict__))),
TxAckOutput(tx=TxAckOutputWrapper(output=TxOutput(**out2.__dict__))),
# segwit
TxRequest(request_type=TXINPUT, details=TxRequestDetailsType(request_index=0, tx_hash=None), serialized=TxRequestSerializedType(
@ -303,7 +303,7 @@ class TestSignSegwitTxNativeP2WPKH(unittest.TestCase):
coin = coins.by_name('Testnet')
seed = bip39.seed(' '.join(['all'] * 12), '')
inp1 = TxAckInputType(
inp1 = TxInput(
# 49'/1'/0'/0/0" - tb1qqzv60m9ajw8drqulta4ld4gfx0rdh82un5s65s
address_n=[49 | 0x80000000, 1 | 0x80000000, 0 | 0x80000000, 0, 0],
amount=12300000,
@ -313,17 +313,17 @@ class TestSignSegwitTxNativeP2WPKH(unittest.TestCase):
sequence=0xffffffff,
multisig=None,
)
ptx1 = TxAckPrevTxType(version=1, lock_time=0, inputs_count=1, outputs_count=2, extra_data_len=0)
pinp1 = TxAckPrevInputType(script_sig=unhexlify('160014d16b8c0680c61fc6ed2e407455715055e41052f5'),
ptx1 = PrevTx(version=1, lock_time=0, inputs_count=1, outputs_count=2, extra_data_len=0)
pinp1 = PrevInput(script_sig=unhexlify('160014d16b8c0680c61fc6ed2e407455715055e41052f5'),
prev_hash=unhexlify('20912f98ea3ed849042efed0fdac8cb4fc301961c5988cba56902d8ffb61c337'),
prev_index=0,
sequence=4294967295)
pout1 = TxAckPrevOutputType(script_pubkey=unhexlify('00140099a7ecbd938ed1839f5f6bf6d50933c6db9d5c'),
pout1 = PrevOutput(script_pubkey=unhexlify('00140099a7ecbd938ed1839f5f6bf6d50933c6db9d5c'),
amount=12300000)
pout2 = TxAckPrevOutputType(script_pubkey=unhexlify('a91458b53ea7f832e8f096e896b8713a8c6df0e892ca87'),
pout2 = PrevOutput(script_pubkey=unhexlify('a91458b53ea7f832e8f096e896b8713a8c6df0e892ca87'),
amount=111145789)
out1 = TxAckOutputType(
out1 = TxOutput(
address='TB1Q694CCP5QCC0UDMFWGP692U2S2HJPQ5H407URTU', # Error: should be lower case
script_type=OutputScriptType.PAYTOADDRESS,
amount=12300000 - 11000 - 5000000,

@ -5,18 +5,18 @@ from trezor.crypto import bip39
from trezor.messages.SignTx import SignTx
from trezor.messages.TxAckInput import TxAckInput
from trezor.messages.TxAckInputWrapper import TxAckInputWrapper
from trezor.messages.TxAckInputType import TxAckInputType
from trezor.messages.TxInput import TxInput
from trezor.messages.TxAckOutput import TxAckOutput
from trezor.messages.TxAckOutputWrapper import TxAckOutputWrapper
from trezor.messages.TxAckOutputType import TxAckOutputType
from trezor.messages.TxOutput import TxOutput
from trezor.messages.TxAckPrevMeta import TxAckPrevMeta
from trezor.messages.TxAckPrevTxType import TxAckPrevTxType
from trezor.messages.PrevTx import PrevTx
from trezor.messages.TxAckPrevInput import TxAckPrevInput
from trezor.messages.TxAckPrevInputWrapper import TxAckPrevInputWrapper
from trezor.messages.TxAckPrevInputType import TxAckPrevInputType
from trezor.messages.PrevInput import PrevInput
from trezor.messages.TxAckPrevOutput import TxAckPrevOutput
from trezor.messages.TxAckPrevOutputWrapper import TxAckPrevOutputWrapper
from trezor.messages.TxAckPrevOutputType import TxAckPrevOutputType
from trezor.messages.PrevOutput import PrevOutput
from trezor.messages.TxRequest import TxRequest
from trezor.messages.RequestType import TXINPUT, TXMETA, TXOUTPUT, TXFINISHED
from trezor.messages.TxRequestDetailsType import TxRequestDetailsType
@ -44,7 +44,7 @@ class TestSignSegwitTxNativeP2WPKH_GRS(unittest.TestCase):
coin = coins.by_name('Groestlcoin Testnet')
seed = bip39.seed(' '.join(['all'] * 12), '')
inp1 = TxAckInputType(
inp1 = TxInput(
# 84'/1'/0'/0/0" - tgrs1qkvwu9g3k2pdxewfqr7syz89r3gj557l3ued7ja
address_n=[84 | 0x80000000, 1 | 0x80000000, 0 | 0x80000000, 0, 0],
amount=12300000,
@ -54,24 +54,24 @@ class TestSignSegwitTxNativeP2WPKH_GRS(unittest.TestCase):
sequence=0xfffffffe,
multisig=None,
)
ptx1 = TxAckPrevTxType(version=1, lock_time=650645, inputs_count=1, outputs_count=2, extra_data_len=0)
pinp1 = TxAckPrevInputType(script_sig=unhexlify('483045022100d9615361c044e91f6dd7bb4455f3ad686cd5a663d7800bb74c448b2706500ccb022026bed24b81a501e8398411c5a9a793741d9bfe39617d51c363dde0a84f44f4f9012102659a6eefcc72d6f2eff92e57095388b17db0b06034946ecd44120e5e7a830ff4'),
ptx1 = PrevTx(version=1, lock_time=650645, inputs_count=1, outputs_count=2, extra_data_len=0)
pinp1 = PrevInput(script_sig=unhexlify('483045022100d9615361c044e91f6dd7bb4455f3ad686cd5a663d7800bb74c448b2706500ccb022026bed24b81a501e8398411c5a9a793741d9bfe39617d51c363dde0a84f44f4f9012102659a6eefcc72d6f2eff92e57095388b17db0b06034946ecd44120e5e7a830ff4'),
prev_hash=unhexlify('1c92508b38239e5c10b23fb46dcf765ee2f3a95b835edbf0943ec21b21711160'),
prev_index=1,
sequence=4294967293)
pout1 = TxAckPrevOutputType(script_pubkey=unhexlify('0014b31dc2a236505a6cb9201fa0411ca38a254a7bf1'),
pout1 = PrevOutput(script_pubkey=unhexlify('0014b31dc2a236505a6cb9201fa0411ca38a254a7bf1'),
amount=12300000)
pout2 = TxAckPrevOutputType(script_pubkey=unhexlify('76a91438cc090e4a4b2e458c33fe35af1c5c0094699ac288ac'),
pout2 = PrevOutput(script_pubkey=unhexlify('76a91438cc090e4a4b2e458c33fe35af1c5c0094699ac288ac'),
amount=9887699777)
out1 = TxAckOutputType(
out1 = TxOutput(
address='2N4Q5FhU2497BryFfUgbqkAJE87aKDv3V3e',
amount=5000000,
script_type=OutputScriptType.PAYTOADDRESS,
address_n=[],
multisig=None,
)
out2 = TxAckOutputType(
out2 = TxOutput(
address='tgrs1qejqxwzfld7zr6mf7ygqy5s5se5xq7vmt9lkd57',
script_type=OutputScriptType.PAYTOADDRESS,
amount=12300000 - 11000 - 5000000,
@ -175,7 +175,7 @@ class TestSignSegwitTxNativeP2WPKH_GRS(unittest.TestCase):
coin = coins.by_name('Groestlcoin Testnet')
seed = bip39.seed(' '.join(['all'] * 12), '')
inp1 = TxAckInputType(
inp1 = TxInput(
# 84'/1'/0'/0/0" - tgrs1qkvwu9g3k2pdxewfqr7syz89r3gj557l3ued7ja
address_n=[84 | 0x80000000, 1 | 0x80000000, 0 | 0x80000000, 0, 0],
amount=12300000,
@ -185,24 +185,24 @@ class TestSignSegwitTxNativeP2WPKH_GRS(unittest.TestCase):
sequence=0xfffffffe,
multisig=None,
)
ptx1 = TxAckPrevTxType(version=1, lock_time=650645, inputs_count=1, outputs_count=2, extra_data_len=0)
pinp1 = TxAckPrevInputType(script_sig=unhexlify('483045022100d9615361c044e91f6dd7bb4455f3ad686cd5a663d7800bb74c448b2706500ccb022026bed24b81a501e8398411c5a9a793741d9bfe39617d51c363dde0a84f44f4f9012102659a6eefcc72d6f2eff92e57095388b17db0b06034946ecd44120e5e7a830ff4'),
ptx1 = PrevTx(version=1, lock_time=650645, inputs_count=1, outputs_count=2, extra_data_len=0)
pinp1 = PrevInput(script_sig=unhexlify('483045022100d9615361c044e91f6dd7bb4455f3ad686cd5a663d7800bb74c448b2706500ccb022026bed24b81a501e8398411c5a9a793741d9bfe39617d51c363dde0a84f44f4f9012102659a6eefcc72d6f2eff92e57095388b17db0b06034946ecd44120e5e7a830ff4'),
prev_hash=unhexlify('1c92508b38239e5c10b23fb46dcf765ee2f3a95b835edbf0943ec21b21711160'),
prev_index=1,
sequence=4294967293)
pout1 = TxAckPrevOutputType(script_pubkey=unhexlify('0014b31dc2a236505a6cb9201fa0411ca38a254a7bf1'),
pout1 = PrevOutput(script_pubkey=unhexlify('0014b31dc2a236505a6cb9201fa0411ca38a254a7bf1'),
amount=12300000)
pout2 = TxAckPrevOutputType(script_pubkey=unhexlify('76a91438cc090e4a4b2e458c33fe35af1c5c0094699ac288ac'),
pout2 = PrevOutput(script_pubkey=unhexlify('76a91438cc090e4a4b2e458c33fe35af1c5c0094699ac288ac'),
amount=9887699777)
out1 = TxAckOutputType(
out1 = TxOutput(
address='2N4Q5FhU2497BryFfUgbqkAJE87aKDv3V3e',
amount=5000000,
script_type=OutputScriptType.PAYTOADDRESS,
address_n=[],
multisig=None,
)
out2 = TxAckOutputType(
out2 = TxOutput(
address=None,
address_n=[84 | 0x80000000, 1 | 0x80000000, 0 | 0x80000000, 1, 0],
script_type=OutputScriptType.PAYTOWITNESS,
@ -261,7 +261,7 @@ class TestSignSegwitTxNativeP2WPKH_GRS(unittest.TestCase):
serialized_tx=unhexlify('d1613f483f2086d076c82fe34674385a86beb08f052d5405fe1aed397f852f4f0000000000feffffff02'),
)),
# the out has to be cloned not to send the same object which was modified
TxAckOutput(tx=TxAckOutputWrapper(output=TxAckOutputType(**out1.__dict__))),
TxAckOutput(tx=TxAckOutputWrapper(output=TxOutput(**out1.__dict__))),
TxRequest(request_type=TXOUTPUT, details=TxRequestDetailsType(request_index=1, tx_hash=None), serialized=TxRequestSerializedType(
# returned serialized out1
@ -269,7 +269,7 @@ class TestSignSegwitTxNativeP2WPKH_GRS(unittest.TestCase):
signature_index=None,
signature=None,
)),
TxAckOutput(tx=TxAckOutputWrapper(output=TxAckOutputType(**out2.__dict__))),
TxAckOutput(tx=TxAckOutputWrapper(output=TxOutput(**out2.__dict__))),
# segwit
TxRequest(request_type=TXINPUT, details=TxRequestDetailsType(request_index=0, tx_hash=None), serialized=TxRequestSerializedType(

@ -5,18 +5,18 @@ from trezor.crypto import bip39
from trezor.messages.SignTx import SignTx
from trezor.messages.TxAckInput import TxAckInput
from trezor.messages.TxAckInputWrapper import TxAckInputWrapper
from trezor.messages.TxAckInputType import TxAckInputType
from trezor.messages.TxInput import TxInput
from trezor.messages.TxAckOutput import TxAckOutput
from trezor.messages.TxAckOutputWrapper import TxAckOutputWrapper
from trezor.messages.TxAckOutputType import TxAckOutputType
from trezor.messages.TxOutput import TxOutput
from trezor.messages.TxAckPrevMeta import TxAckPrevMeta
from trezor.messages.TxAckPrevTxType import TxAckPrevTxType
from trezor.messages.PrevTx import PrevTx
from trezor.messages.TxAckPrevInput import TxAckPrevInput
from trezor.messages.TxAckPrevInputWrapper import TxAckPrevInputWrapper
from trezor.messages.TxAckPrevInputType import TxAckPrevInputType
from trezor.messages.PrevInput import PrevInput
from trezor.messages.TxAckPrevOutput import TxAckPrevOutput
from trezor.messages.TxAckPrevOutputWrapper import TxAckPrevOutputWrapper
from trezor.messages.TxAckPrevOutputType import TxAckPrevOutputType
from trezor.messages.PrevOutput import PrevOutput
from trezor.messages.TxRequest import TxRequest
from trezor.messages.RequestType import TXINPUT, TXMETA, TXOUTPUT, TXFINISHED
from trezor.messages.TxRequestDetailsType import TxRequestDetailsType
@ -43,7 +43,7 @@ class TestSignSegwitTxP2WPKHInP2SH(unittest.TestCase):
coin = coins.by_name('Testnet')
seed = bip39.seed(' '.join(['all'] * 12), '')
inp1 = TxAckInputType(
inp1 = TxInput(
# 49'/1'/0'/1/0" - 2N1LGaGg836mqSQqiuUBLfcyGBhyZbremDX
address_n=[49 | 0x80000000, 1 | 0x80000000, 0 | 0x80000000, 1, 0],
amount=123456789,
@ -53,24 +53,24 @@ class TestSignSegwitTxP2WPKHInP2SH(unittest.TestCase):
sequence=0xffffffff,
multisig=None,
)
ptx1 = TxAckPrevTxType(version=1, lock_time=0, inputs_count=1, outputs_count=2, extra_data_len=0)
pinp1 = TxAckPrevInputType(script_sig=unhexlify('4730440220548e087d0426b20b8a571b03b9e05829f7558b80c53c12143e342f56ab29e51d02205b68cb7fb223981d4c999725ac1485a982c4259c4f50b8280f137878c232998a012102794a25b254a268e59a5869da57fbae2fadc6727cb3309321dab409b12b2fa17c'),
ptx1 = PrevTx(version=1, lock_time=0, inputs_count=1, outputs_count=2, extra_data_len=0)
pinp1 = PrevInput(script_sig=unhexlify('4730440220548e087d0426b20b8a571b03b9e05829f7558b80c53c12143e342f56ab29e51d02205b68cb7fb223981d4c999725ac1485a982c4259c4f50b8280f137878c232998a012102794a25b254a268e59a5869da57fbae2fadc6727cb3309321dab409b12b2fa17c'),
prev_hash=unhexlify('802cabf0843b945eabe136d7fc7c89f41021658abf56cba000acbce88c41143a'),
prev_index=0,
sequence=4294967295)
pout1 = TxAckPrevOutputType(script_pubkey=unhexlify('a91458b53ea7f832e8f096e896b8713a8c6df0e892ca87'),
pout1 = PrevOutput(script_pubkey=unhexlify('a91458b53ea7f832e8f096e896b8713a8c6df0e892ca87'),
amount=123456789)
pout2 = TxAckPrevOutputType(script_pubkey=unhexlify('76a914b84bacdcd8f4cc59274a5bfb73f804ca10f7fd1488ac'),
pout2 = PrevOutput(script_pubkey=unhexlify('76a914b84bacdcd8f4cc59274a5bfb73f804ca10f7fd1488ac'),
amount=865519308)
out1 = TxAckOutputType(
out1 = TxOutput(
address='mhRx1CeVfaayqRwq5zgRQmD7W5aWBfD5mC',
amount=12300000,
script_type=OutputScriptType.PAYTOADDRESS,
address_n=[],
multisig=None,
)
out2 = TxAckOutputType(
out2 = TxOutput(
address='2N1LGaGg836mqSQqiuUBLfcyGBhyZbremDX',
script_type=OutputScriptType.PAYTOADDRESS,
amount=123456789 - 11000 - 12300000,
@ -171,7 +171,7 @@ class TestSignSegwitTxP2WPKHInP2SH(unittest.TestCase):
coin = coins.by_name('Testnet')
seed = bip39.seed(' '.join(['all'] * 12), '')
inp1 = TxAckInputType(
inp1 = TxInput(
# 49'/1'/0'/1/0" - 2N1LGaGg836mqSQqiuUBLfcyGBhyZbremDX
address_n=[49 | 0x80000000, 1 | 0x80000000, 0 | 0x80000000, 1, 0],
amount=123456789,
@ -181,24 +181,24 @@ class TestSignSegwitTxP2WPKHInP2SH(unittest.TestCase):
sequence=0xffffffff,
multisig=None,
)
ptx1 = TxAckPrevTxType(version=1, lock_time=0, inputs_count=1, outputs_count=2, extra_data_len=0)
pinp1 = TxAckPrevInputType(script_sig=unhexlify('4730440220548e087d0426b20b8a571b03b9e05829f7558b80c53c12143e342f56ab29e51d02205b68cb7fb223981d4c999725ac1485a982c4259c4f50b8280f137878c232998a012102794a25b254a268e59a5869da57fbae2fadc6727cb3309321dab409b12b2fa17c'),
ptx1 = PrevTx(version=1, lock_time=0, inputs_count=1, outputs_count=2, extra_data_len=0)
pinp1 = PrevInput(script_sig=unhexlify('4730440220548e087d0426b20b8a571b03b9e05829f7558b80c53c12143e342f56ab29e51d02205b68cb7fb223981d4c999725ac1485a982c4259c4f50b8280f137878c232998a012102794a25b254a268e59a5869da57fbae2fadc6727cb3309321dab409b12b2fa17c'),
prev_hash=unhexlify('802cabf0843b945eabe136d7fc7c89f41021658abf56cba000acbce88c41143a'),
prev_index=0,
sequence=4294967295)
pout1 = TxAckPrevOutputType(script_pubkey=unhexlify('a91458b53ea7f832e8f096e896b8713a8c6df0e892ca87'),
pout1 = PrevOutput(script_pubkey=unhexlify('a91458b53ea7f832e8f096e896b8713a8c6df0e892ca87'),
amount=123456789)
pout2 = TxAckPrevOutputType(script_pubkey=unhexlify('76a914b84bacdcd8f4cc59274a5bfb73f804ca10f7fd1488ac'),
pout2 = PrevOutput(script_pubkey=unhexlify('76a914b84bacdcd8f4cc59274a5bfb73f804ca10f7fd1488ac'),
amount=865519308)
out1 = TxAckOutputType(
out1 = TxOutput(
address='mhRx1CeVfaayqRwq5zgRQmD7W5aWBfD5mC',
amount=12300000,
script_type=OutputScriptType.PAYTOADDRESS,
address_n=[],
multisig=None,
)
out2 = TxAckOutputType(
out2 = TxOutput(
address_n=[49 | 0x80000000, 1 | 0x80000000, 0 | 0x80000000, 1, 0],
script_type=OutputScriptType.PAYTOP2SHWITNESS,
amount=123456789 - 11000 - 12300000,
@ -260,7 +260,7 @@ class TestSignSegwitTxP2WPKHInP2SH(unittest.TestCase):
'37c361fb8f2d9056ba8c98c5611930fcb48cacfdd0fe2e0449d83eea982f91200000000017160014d16b8c0680c61fc6ed2e407455715055e41052f5ffffffff02'),
)),
# the out has to be cloned not to send the same object which was modified
TxAckOutput(tx=TxAckOutputWrapper(output=TxAckOutputType(**out1.__dict__))),
TxAckOutput(tx=TxAckOutputWrapper(output=TxOutput(**out1.__dict__))),
TxRequest(request_type=TXOUTPUT, details=TxRequestDetailsType(request_index=1, tx_hash=None),
serialized=TxRequestSerializedType(
@ -270,7 +270,7 @@ class TestSignSegwitTxP2WPKHInP2SH(unittest.TestCase):
signature_index=None,
signature=None,
)),
TxAckOutput(tx=TxAckOutputWrapper(output=TxAckOutputType(**out2.__dict__))),
TxAckOutput(tx=TxAckOutputWrapper(output=TxOutput(**out2.__dict__))),
# segwit
TxRequest(request_type=TXINPUT, details=TxRequestDetailsType(request_index=0, tx_hash=None),
@ -308,7 +308,7 @@ class TestSignSegwitTxP2WPKHInP2SH(unittest.TestCase):
coin = coins.by_name('Testnet')
seed = bip39.seed(' '.join(['all'] * 12), '')
inp1 = TxAckInputType(
inp1 = TxInput(
# 49'/1'/0'/1/0" - 2N1LGaGg836mqSQqiuUBLfcyGBhyZbremDX
address_n=[49 | 0x80000000, 1 | 0x80000000, 0 | 0x80000000, 1, 0],
amount=10,
@ -318,17 +318,17 @@ class TestSignSegwitTxP2WPKHInP2SH(unittest.TestCase):
sequence=0xffffffff,
multisig=None,
)
ptx1 = TxAckPrevTxType(version=1, lock_time=0, inputs_count=1, outputs_count=2, extra_data_len=0)
pinp1 = TxAckPrevInputType(script_sig=unhexlify('4730440220548e087d0426b20b8a571b03b9e05829f7558b80c53c12143e342f56ab29e51d02205b68cb7fb223981d4c999725ac1485a982c4259c4f50b8280f137878c232998a012102794a25b254a268e59a5869da57fbae2fadc6727cb3309321dab409b12b2fa17c'),
ptx1 = PrevTx(version=1, lock_time=0, inputs_count=1, outputs_count=2, extra_data_len=0)
pinp1 = PrevInput(script_sig=unhexlify('4730440220548e087d0426b20b8a571b03b9e05829f7558b80c53c12143e342f56ab29e51d02205b68cb7fb223981d4c999725ac1485a982c4259c4f50b8280f137878c232998a012102794a25b254a268e59a5869da57fbae2fadc6727cb3309321dab409b12b2fa17c'),
prev_hash=unhexlify('802cabf0843b945eabe136d7fc7c89f41021658abf56cba000acbce88c41143a'),
prev_index=0,
sequence=4294967295)
pout1 = TxAckPrevOutputType(script_pubkey=unhexlify('a91458b53ea7f832e8f096e896b8713a8c6df0e892ca87'),
pout1 = PrevOutput(script_pubkey=unhexlify('a91458b53ea7f832e8f096e896b8713a8c6df0e892ca87'),
amount=123456789)
pout2 = TxAckPrevOutputType(script_pubkey=unhexlify('76a914b84bacdcd8f4cc59274a5bfb73f804ca10f7fd1488ac'),
pout2 = PrevOutput(script_pubkey=unhexlify('76a914b84bacdcd8f4cc59274a5bfb73f804ca10f7fd1488ac'),
amount=865519308)
inpattack = TxAckInputType(
inpattack = TxInput(
# 49'/1'/0'/1/0" - 2N1LGaGg836mqSQqiuUBLfcyGBhyZbremDX
address_n=[49 | 0x80000000, 1 | 0x80000000, 0 | 0x80000000, 1, 0],
amount=9, # modified!
@ -338,14 +338,14 @@ class TestSignSegwitTxP2WPKHInP2SH(unittest.TestCase):
sequence=0xffffffff,
multisig=None,
)
out1 = TxAckOutputType(
out1 = TxOutput(
address='mhRx1CeVfaayqRwq5zgRQmD7W5aWBfD5mC',
amount=8,
script_type=OutputScriptType.PAYTOADDRESS,
address_n=[],
multisig=None,
)
out2 = TxAckOutputType(
out2 = TxOutput(
address_n=[49 | 0x80000000, 1 | 0x80000000, 0 | 0x80000000, 1, 0],
script_type=OutputScriptType.PAYTOP2SHWITNESS,
amount=1,

@ -5,18 +5,18 @@ from trezor.crypto import bip39
from trezor.messages.SignTx import SignTx
from trezor.messages.TxAckInput import TxAckInput
from trezor.messages.TxAckInputWrapper import TxAckInputWrapper
from trezor.messages.TxAckInputType import TxAckInputType
from trezor.messages.TxInput import TxInput
from trezor.messages.TxAckOutput import TxAckOutput
from trezor.messages.TxAckOutputWrapper import TxAckOutputWrapper
from trezor.messages.TxAckOutputType import TxAckOutputType
from trezor.messages.TxOutput import TxOutput
from trezor.messages.TxAckPrevMeta import TxAckPrevMeta
from trezor.messages.TxAckPrevTxType import TxAckPrevTxType
from trezor.messages.PrevTx import PrevTx
from trezor.messages.TxAckPrevInput import TxAckPrevInput
from trezor.messages.TxAckPrevInputWrapper import TxAckPrevInputWrapper
from trezor.messages.TxAckPrevInputType import TxAckPrevInputType
from trezor.messages.PrevInput import PrevInput
from trezor.messages.TxAckPrevOutput import TxAckPrevOutput
from trezor.messages.TxAckPrevOutputWrapper import TxAckPrevOutputWrapper
from trezor.messages.TxAckPrevOutputType import TxAckPrevOutputType
from trezor.messages.PrevOutput import PrevOutput
from trezor.messages.TxRequest import TxRequest
from trezor.messages.RequestType import TXINPUT, TXMETA, TXOUTPUT, TXFINISHED
from trezor.messages.TxRequestDetailsType import TxRequestDetailsType
@ -44,7 +44,7 @@ class TestSignSegwitTxP2WPKHInP2SH_GRS(unittest.TestCase):
coin = coins.by_name('Groestlcoin Testnet')
seed = bip39.seed(' '.join(['all'] * 12), '')
inp1 = TxAckInputType(
inp1 = TxInput(
# 49'/1'/0'/1/0" - 2N1LGaGg836mqSQqiuUBLfcyGBhyZYBtBZ7
address_n=[49 | 0x80000000, 1 | 0x80000000, 0 | 0x80000000, 1, 0],
amount=123456789,
@ -54,24 +54,24 @@ class TestSignSegwitTxP2WPKHInP2SH_GRS(unittest.TestCase):
sequence=0xfffffffe,
multisig=None,
)
ptx1 = TxAckPrevTxType(version=1, lock_time=650749, inputs_count=1, outputs_count=2, extra_data_len=0)
pinp1 = TxAckPrevInputType(script_sig=unhexlify('47304402201f8f57f708144c3a11da322546cb37bd385aa825d940c37e8016f0efd6ec3e9402202a41bc02c29e4f3f13efd4bededbcd4308a6393279111d614ee1f7635cf3e65701210371546a36bdf6bc82087301b3f6e759736dc8790150673d2e7e2715d2ad72f3a4'),
ptx1 = PrevTx(version=1, lock_time=650749, inputs_count=1, outputs_count=2, extra_data_len=0)
pinp1 = PrevInput(script_sig=unhexlify('47304402201f8f57f708144c3a11da322546cb37bd385aa825d940c37e8016f0efd6ec3e9402202a41bc02c29e4f3f13efd4bededbcd4308a6393279111d614ee1f7635cf3e65701210371546a36bdf6bc82087301b3f6e759736dc8790150673d2e7e2715d2ad72f3a4'),
prev_hash=unhexlify('4f2f857f39ed1afe05542d058fb0be865a387446e32fc876d086203f483f61d1'),
prev_index=1,
sequence=4294967294)
pout1 = TxAckPrevOutputType(script_pubkey=unhexlify('a91458b53ea7f832e8f096e896b8713a8c6df0e892ca87'),
pout1 = PrevOutput(script_pubkey=unhexlify('a91458b53ea7f832e8f096e896b8713a8c6df0e892ca87'),
amount=123456789)
pout2 = TxAckPrevOutputType(script_pubkey=unhexlify('76a91435528b20e9a793cf2c3a1cf9cff1f2127ad377da88ac'),
pout2 = PrevOutput(script_pubkey=unhexlify('76a91435528b20e9a793cf2c3a1cf9cff1f2127ad377da88ac'),
amount=9764242764)
out1 = TxAckOutputType(
out1 = TxOutput(
address='mvbu1Gdy8SUjTenqerxUaZyYjmvedc787y',
amount=12300000,
script_type=OutputScriptType.PAYTOADDRESS,
address_n=[],
multisig=None,
)
out2 = TxAckOutputType(
out2 = TxOutput(
address='2N1LGaGg836mqSQqiuUBLfcyGBhyZYBtBZ7',
script_type=OutputScriptType.PAYTOADDRESS,
amount=123456789 - 11000 - 12300000,
@ -175,7 +175,7 @@ class TestSignSegwitTxP2WPKHInP2SH_GRS(unittest.TestCase):
coin = coins.by_name('Groestlcoin Testnet')
seed = bip39.seed(' '.join(['all'] * 12), '')
inp1 = TxAckInputType(
inp1 = TxInput(
# 49'/1'/0'/1/0" - 2N1LGaGg836mqSQqiuUBLfcyGBhyZYBtBZ7
address_n=[49 | 0x80000000, 1 | 0x80000000, 0 | 0x80000000, 1, 0],
amount=123456789,
@ -185,24 +185,24 @@ class TestSignSegwitTxP2WPKHInP2SH_GRS(unittest.TestCase):
sequence=0xfffffffe,
multisig=None,
)
ptx1 = TxAckPrevTxType(version=1, lock_time=650749, inputs_count=1, outputs_count=2, extra_data_len=0)
pinp1 = TxAckPrevInputType(script_sig=unhexlify('47304402201f8f57f708144c3a11da322546cb37bd385aa825d940c37e8016f0efd6ec3e9402202a41bc02c29e4f3f13efd4bededbcd4308a6393279111d614ee1f7635cf3e65701210371546a36bdf6bc82087301b3f6e759736dc8790150673d2e7e2715d2ad72f3a4'),
ptx1 = PrevTx(version=1, lock_time=650749, inputs_count=1, outputs_count=2, extra_data_len=0)
pinp1 = PrevInput(script_sig=unhexlify('47304402201f8f57f708144c3a11da322546cb37bd385aa825d940c37e8016f0efd6ec3e9402202a41bc02c29e4f3f13efd4bededbcd4308a6393279111d614ee1f7635cf3e65701210371546a36bdf6bc82087301b3f6e759736dc8790150673d2e7e2715d2ad72f3a4'),
prev_hash=unhexlify('4f2f857f39ed1afe05542d058fb0be865a387446e32fc876d086203f483f61d1'),
prev_index=1,
sequence=4294967294)
pout1 = TxAckPrevOutputType(script_pubkey=unhexlify('a91458b53ea7f832e8f096e896b8713a8c6df0e892ca87'),
pout1 = PrevOutput(script_pubkey=unhexlify('a91458b53ea7f832e8f096e896b8713a8c6df0e892ca87'),
amount=123456789)
pout2 = TxAckPrevOutputType(script_pubkey=unhexlify('76a91435528b20e9a793cf2c3a1cf9cff1f2127ad377da88ac'),
pout2 = PrevOutput(script_pubkey=unhexlify('76a91435528b20e9a793cf2c3a1cf9cff1f2127ad377da88ac'),
amount=9764242764)
out1 = TxAckOutputType(
out1 = TxOutput(
address='mvbu1Gdy8SUjTenqerxUaZyYjmvedc787y',
amount=12300000,
script_type=OutputScriptType.PAYTOADDRESS,
address_n=[],
multisig=None,
)
out2 = TxAckOutputType(
out2 = TxOutput(
address_n=[49 | 0x80000000, 1 | 0x80000000, 0 | 0x80000000, 1, 0],
script_type=OutputScriptType.PAYTOP2SHWITNESS,
amount=123456789 - 11000 - 12300000,
@ -265,7 +265,7 @@ class TestSignSegwitTxP2WPKHInP2SH_GRS(unittest.TestCase):
'cf60ded29a2bd7ebf93453feace8551889d0321beab90c4f6e5c9d2fce8ba4090000000017160014d16b8c0680c61fc6ed2e407455715055e41052f5feffffff02'),
)),
# the out has to be cloned not to send the same object which was modified
TxAckOutput(tx=TxAckOutputWrapper(output=TxAckOutputType(**out1.__dict__))),
TxAckOutput(tx=TxAckOutputWrapper(output=TxOutput(**out1.__dict__))),
TxRequest(request_type=TXOUTPUT, details=TxRequestDetailsType(request_index=1, tx_hash=None),
serialized=TxRequestSerializedType(
@ -275,7 +275,7 @@ class TestSignSegwitTxP2WPKHInP2SH_GRS(unittest.TestCase):
signature_index=None,
signature=None,
)),
TxAckOutput(tx=TxAckOutputWrapper(output=TxAckOutputType(**out2.__dict__))),
TxAckOutput(tx=TxAckOutputWrapper(output=TxOutput(**out2.__dict__))),
# segwit
TxRequest(request_type=TXINPUT, details=TxRequestDetailsType(request_index=0, tx_hash=None),

@ -1,6 +1,6 @@
from common import *
from trezor.messages.TxAckInputType import TxAckInputType
from trezor.messages.TxInput import TxInput
from trezor.messages import InputScriptType
from apps.bitcoin import writers
@ -8,7 +8,7 @@ from apps.bitcoin import writers
class TestWriters(unittest.TestCase):
def test_tx_input(self):
inp = TxAckInputType(
inp = TxInput(
address_n=[0],
amount=390000,
prev_hash=unhexlify(
@ -28,7 +28,7 @@ class TestWriters(unittest.TestCase):
self.assertRaises(AssertionError, writers.write_tx_input, b, inp, inp.script_sig)
def test_tx_input_check(self):
inp = TxAckInputType(
inp = TxInput(
address_n=[0],
amount=390000,
prev_hash=unhexlify(

@ -5,18 +5,18 @@ from trezor.crypto import bip32, bip39
from trezor.messages.SignTx import SignTx
from trezor.messages.TxAckInput import TxAckInput
from trezor.messages.TxAckInputWrapper import TxAckInputWrapper
from trezor.messages.TxAckInputType import TxAckInputType
from trezor.messages.TxInput import TxInput
from trezor.messages.TxAckOutput import TxAckOutput
from trezor.messages.TxAckOutputWrapper import TxAckOutputWrapper
from trezor.messages.TxAckOutputType import TxAckOutputType
from trezor.messages.TxOutput import TxOutput
from trezor.messages.TxAckPrevMeta import TxAckPrevMeta
from trezor.messages.TxAckPrevTxType import TxAckPrevTxType
from trezor.messages.PrevTx import PrevTx
from trezor.messages.TxAckPrevInput import TxAckPrevInput
from trezor.messages.TxAckPrevInputWrapper import TxAckPrevInputWrapper
from trezor.messages.TxAckPrevInputType import TxAckPrevInputType
from trezor.messages.PrevInput import PrevInput
from trezor.messages.TxAckPrevOutput import TxAckPrevOutput
from trezor.messages.TxAckPrevOutputWrapper import TxAckPrevOutputWrapper
from trezor.messages.TxAckPrevOutputType import TxAckPrevOutputType
from trezor.messages.PrevOutput import PrevOutput
from trezor.messages.TxRequest import TxRequest
from trezor.messages.RequestType import TXINPUT, TXOUTPUT, TXMETA
from trezor.messages.TxRequestDetailsType import TxRequestDetailsType
@ -45,22 +45,22 @@ class TestSignTxFeeThreshold(unittest.TestCase):
def test_over_fee_threshold(self):
coin_bitcoin = coins.by_name('Bitcoin')
ptx1 = TxAckPrevTxType(version=1, lock_time=0, inputs_count=2, outputs_count=1, extra_data_len=0)
pinp1 = TxAckPrevInputType(script_sig=unhexlify('483045022072ba61305fe7cb542d142b8f3299a7b10f9ea61f6ffaab5dca8142601869d53c0221009a8027ed79eb3b9bc13577ac2853269323434558528c6b6a7e542be46e7e9a820141047a2d177c0f3626fc68c53610b0270fa6156181f46586c679ba6a88b34c6f4874686390b4d92e5769fbb89c8050b984f4ec0b257a0e5c4ff8bd3b035a51709503'),
ptx1 = PrevTx(version=1, lock_time=0, inputs_count=2, outputs_count=1, extra_data_len=0)
pinp1 = PrevInput(script_sig=unhexlify('483045022072ba61305fe7cb542d142b8f3299a7b10f9ea61f6ffaab5dca8142601869d53c0221009a8027ed79eb3b9bc13577ac2853269323434558528c6b6a7e542be46e7e9a820141047a2d177c0f3626fc68c53610b0270fa6156181f46586c679ba6a88b34c6f4874686390b4d92e5769fbb89c8050b984f4ec0b257a0e5c4ff8bd3b035a51709503'),
prev_hash=unhexlify('c16a03f1cf8f99f6b5297ab614586cacec784c2d259af245909dedb0e39eddcf'),
prev_index=1)
pinp2 = TxAckPrevInputType(script_sig=unhexlify('48304502200fd63adc8f6cb34359dc6cca9e5458d7ea50376cbd0a74514880735e6d1b8a4c0221008b6ead7fe5fbdab7319d6dfede3a0bc8e2a7c5b5a9301636d1de4aa31a3ee9b101410486ad608470d796236b003635718dfc07c0cac0cfc3bfc3079e4f491b0426f0676e6643a39198e8e7bdaffb94f4b49ea21baa107ec2e237368872836073668214'),
pinp2 = PrevInput(script_sig=unhexlify('48304502200fd63adc8f6cb34359dc6cca9e5458d7ea50376cbd0a74514880735e6d1b8a4c0221008b6ead7fe5fbdab7319d6dfede3a0bc8e2a7c5b5a9301636d1de4aa31a3ee9b101410486ad608470d796236b003635718dfc07c0cac0cfc3bfc3079e4f491b0426f0676e6643a39198e8e7bdaffb94f4b49ea21baa107ec2e237368872836073668214'),
prev_hash=unhexlify('1ae39a2f8d59670c8fc61179148a8e61e039d0d9e8ab08610cb69b4a19453eaf'),
prev_index=1)
pout1 = TxAckPrevOutputType(script_pubkey=unhexlify('76a91424a56db43cf6f2b02e838ea493f95d8d6047423188ac'),
pout1 = PrevOutput(script_pubkey=unhexlify('76a91424a56db43cf6f2b02e838ea493f95d8d6047423188ac'),
amount=390000)
inp1 = TxAckInputType(address_n=[0], # 14LmW5k4ssUrtbAB4255zdqv3b4w1TuX9e
inp1 = TxInput(address_n=[0], # 14LmW5k4ssUrtbAB4255zdqv3b4w1TuX9e
# amount=390000,
prev_hash=unhexlify('d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882'),
prev_index=0,
amount=None)
out1 = TxAckOutputType(address='1MJ2tj2ThBE62zXbBYA5ZaN3fdve5CPAz1',
out1 = TxOutput(address='1MJ2tj2ThBE62zXbBYA5ZaN3fdve5CPAz1',
amount=390000 - 100000, # fee increased to 100000 => too high
multisig=None,
script_type=OutputScriptType.PAYTOADDRESS,
@ -108,25 +108,25 @@ class TestSignTxFeeThreshold(unittest.TestCase):
def test_under_threshold(self):
coin_bitcoin = coins.by_name('Bitcoin')
ptx1 = TxAckPrevTxType(version=1, lock_time=0, inputs_count=2, outputs_count=1, extra_data_len=0)
pinp1 = TxAckPrevInputType(script_sig=unhexlify('483045022072ba61305fe7cb542d142b8f3299a7b10f9ea61f6ffaab5dca8142601869d53c0221009a8027ed79eb3b9bc13577ac2853269323434558528c6b6a7e542be46e7e9a820141047a2d177c0f3626fc68c53610b0270fa6156181f46586c679ba6a88b34c6f4874686390b4d92e5769fbb89c8050b984f4ec0b257a0e5c4ff8bd3b035a51709503'),
ptx1 = PrevTx(version=1, lock_time=0, inputs_count=2, outputs_count=1, extra_data_len=0)
pinp1 = PrevInput(script_sig=unhexlify('483045022072ba61305fe7cb542d142b8f3299a7b10f9ea61f6ffaab5dca8142601869d53c0221009a8027ed79eb3b9bc13577ac2853269323434558528c6b6a7e542be46e7e9a820141047a2d177c0f3626fc68c53610b0270fa6156181f46586c679ba6a88b34c6f4874686390b4d92e5769fbb89c8050b984f4ec0b257a0e5c4ff8bd3b035a51709503'),
prev_hash=unhexlify('c16a03f1cf8f99f6b5297ab614586cacec784c2d259af245909dedb0e39eddcf'),
prev_index=1,
sequence=0xffff_ffff)
pinp2 = TxAckPrevInputType(script_sig=unhexlify('48304502200fd63adc8f6cb34359dc6cca9e5458d7ea50376cbd0a74514880735e6d1b8a4c0221008b6ead7fe5fbdab7319d6dfede3a0bc8e2a7c5b5a9301636d1de4aa31a3ee9b101410486ad608470d796236b003635718dfc07c0cac0cfc3bfc3079e4f491b0426f0676e6643a39198e8e7bdaffb94f4b49ea21baa107ec2e237368872836073668214'),
pinp2 = PrevInput(script_sig=unhexlify('48304502200fd63adc8f6cb34359dc6cca9e5458d7ea50376cbd0a74514880735e6d1b8a4c0221008b6ead7fe5fbdab7319d6dfede3a0bc8e2a7c5b5a9301636d1de4aa31a3ee9b101410486ad608470d796236b003635718dfc07c0cac0cfc3bfc3079e4f491b0426f0676e6643a39198e8e7bdaffb94f4b49ea21baa107ec2e237368872836073668214'),
prev_hash=unhexlify('1ae39a2f8d59670c8fc61179148a8e61e039d0d9e8ab08610cb69b4a19453eaf'),
prev_index=1,
sequence=0xffff_ffff)
pout1 = TxAckPrevOutputType(script_pubkey=unhexlify('76a91424a56db43cf6f2b02e838ea493f95d8d6047423188ac'),
pout1 = PrevOutput(script_pubkey=unhexlify('76a91424a56db43cf6f2b02e838ea493f95d8d6047423188ac'),
amount=390000)
inp1 = TxAckInputType(address_n=[0], # 14LmW5k4ssUrtbAB4255zdqv3b4w1TuX9e
inp1 = TxInput(address_n=[0], # 14LmW5k4ssUrtbAB4255zdqv3b4w1TuX9e
amount=390000,
prev_hash=unhexlify('d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882'),
prev_index=0,
multisig=None,
sequence=0xffff_ffff)
out1 = TxAckOutputType(address='1MJ2tj2ThBE62zXbBYA5ZaN3fdve5CPAz1',
out1 = TxOutput(address='1MJ2tj2ThBE62zXbBYA5ZaN3fdve5CPAz1',
amount=390000 - 90000, # fee increased to 90000, slightly less than the threshold
script_type=OutputScriptType.PAYTOADDRESS,
multisig=None,

@ -5,18 +5,18 @@ from trezor.crypto import bip32, bip39
from trezor.messages.SignTx import SignTx
from trezor.messages.TxAckInput import TxAckInput
from trezor.messages.TxAckInputWrapper import TxAckInputWrapper
from trezor.messages.TxAckInputType import TxAckInputType
from trezor.messages.TxInput import TxInput
from trezor.messages.TxAckOutput import TxAckOutput
from trezor.messages.TxAckOutputWrapper import TxAckOutputWrapper
from trezor.messages.TxAckOutputType import TxAckOutputType
from trezor.messages.TxOutput import TxOutput
from trezor.messages.TxAckPrevMeta import TxAckPrevMeta
from trezor.messages.TxAckPrevTxType import TxAckPrevTxType
from trezor.messages.PrevTx import PrevTx
from trezor.messages.TxAckPrevInput import TxAckPrevInput
from trezor.messages.TxAckPrevInputWrapper import TxAckPrevInputWrapper
from trezor.messages.TxAckPrevInputType import TxAckPrevInputType
from trezor.messages.PrevInput import PrevInput
from trezor.messages.TxAckPrevOutput import TxAckPrevOutput
from trezor.messages.TxAckPrevOutputWrapper import TxAckPrevOutputWrapper
from trezor.messages.TxAckPrevOutputType import TxAckPrevOutputType
from trezor.messages.PrevOutput import PrevOutput
from trezor.messages.TxRequest import TxRequest
from trezor.messages.RequestType import TXINPUT, TXOUTPUT, TXMETA, TXFINISHED
from trezor.messages.TxRequestDetailsType import TxRequestDetailsType
@ -42,26 +42,26 @@ class TestSignTx(unittest.TestCase):
coin_bitcoin = coins.by_name('Bitcoin')
ptx1 = TxAckPrevTxType(version=1, lock_time=0, inputs_count=2, outputs_count=1, extra_data_len=0)
pinp1 = TxAckPrevInputType(script_sig=unhexlify('483045022072ba61305fe7cb542d142b8f3299a7b10f9ea61f6ffaab5dca8142601869d53c0221009a8027ed79eb3b9bc13577ac2853269323434558528c6b6a7e542be46e7e9a820141047a2d177c0f3626fc68c53610b0270fa6156181f46586c679ba6a88b34c6f4874686390b4d92e5769fbb89c8050b984f4ec0b257a0e5c4ff8bd3b035a51709503'),
ptx1 = PrevTx(version=1, lock_time=0, inputs_count=2, outputs_count=1, extra_data_len=0)
pinp1 = PrevInput(script_sig=unhexlify('483045022072ba61305fe7cb542d142b8f3299a7b10f9ea61f6ffaab5dca8142601869d53c0221009a8027ed79eb3b9bc13577ac2853269323434558528c6b6a7e542be46e7e9a820141047a2d177c0f3626fc68c53610b0270fa6156181f46586c679ba6a88b34c6f4874686390b4d92e5769fbb89c8050b984f4ec0b257a0e5c4ff8bd3b035a51709503'),
prev_hash=unhexlify('c16a03f1cf8f99f6b5297ab614586cacec784c2d259af245909dedb0e39eddcf'),
prev_index=1,
sequence=0xffff_ffff)
pinp2 = TxAckPrevInputType(script_sig=unhexlify('48304502200fd63adc8f6cb34359dc6cca9e5458d7ea50376cbd0a74514880735e6d1b8a4c0221008b6ead7fe5fbdab7319d6dfede3a0bc8e2a7c5b5a9301636d1de4aa31a3ee9b101410486ad608470d796236b003635718dfc07c0cac0cfc3bfc3079e4f491b0426f0676e6643a39198e8e7bdaffb94f4b49ea21baa107ec2e237368872836073668214'),
pinp2 = PrevInput(script_sig=unhexlify('48304502200fd63adc8f6cb34359dc6cca9e5458d7ea50376cbd0a74514880735e6d1b8a4c0221008b6ead7fe5fbdab7319d6dfede3a0bc8e2a7c5b5a9301636d1de4aa31a3ee9b101410486ad608470d796236b003635718dfc07c0cac0cfc3bfc3079e4f491b0426f0676e6643a39198e8e7bdaffb94f4b49ea21baa107ec2e237368872836073668214'),
prev_hash=unhexlify('1ae39a2f8d59670c8fc61179148a8e61e039d0d9e8ab08610cb69b4a19453eaf'),
prev_index=1,
sequence=0xffff_ffff)
pout1 = TxAckPrevOutputType(script_pubkey=unhexlify('76a91424a56db43cf6f2b02e838ea493f95d8d6047423188ac'),
pout1 = PrevOutput(script_pubkey=unhexlify('76a91424a56db43cf6f2b02e838ea493f95d8d6047423188ac'),
amount=200000 + 200000 - 10000)
inp1 = TxAckInputType(address_n=[44 | 0x80000000, 0 | 0x80000000, 0 | 0x80000000, 0, 0],
inp1 = TxInput(address_n=[44 | 0x80000000, 0 | 0x80000000, 0 | 0x80000000, 0, 0],
# amount=390000,
prev_hash=unhexlify('d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882'),
prev_index=0,
amount=390000,
multisig=None,
sequence=0xffff_ffff)
out1 = TxAckOutputType(address='1MJ2tj2ThBE62zXbBYA5ZaN3fdve5CPAz1',
out1 = TxOutput(address='1MJ2tj2ThBE62zXbBYA5ZaN3fdve5CPAz1',
amount=390000 - 10000,
script_type=OutputScriptType.PAYTOADDRESS,
multisig=None)

@ -5,18 +5,18 @@ from trezor.crypto import bip39
from trezor.messages.SignTx import SignTx
from trezor.messages.TxAckInput import TxAckInput
from trezor.messages.TxAckInputWrapper import TxAckInputWrapper
from trezor.messages.TxAckInputType import TxAckInputType
from trezor.messages.TxInput import TxInput
from trezor.messages.TxAckOutput import TxAckOutput
from trezor.messages.TxAckOutputWrapper import TxAckOutputWrapper
from trezor.messages.TxAckOutputType import TxAckOutputType
from trezor.messages.TxOutput import TxOutput
from trezor.messages.TxAckPrevMeta import TxAckPrevMeta
from trezor.messages.TxAckPrevTxType import TxAckPrevTxType
from trezor.messages.PrevTx import PrevTx
from trezor.messages.TxAckPrevInput import TxAckPrevInput
from trezor.messages.TxAckPrevInputWrapper import TxAckPrevInputWrapper
from trezor.messages.TxAckPrevInputType import TxAckPrevInputType
from trezor.messages.PrevInput import PrevInput
from trezor.messages.TxAckPrevOutput import TxAckPrevOutput
from trezor.messages.TxAckPrevOutputWrapper import TxAckPrevOutputWrapper
from trezor.messages.TxAckPrevOutputType import TxAckPrevOutputType
from trezor.messages.PrevOutput import PrevOutput
from trezor.messages.TxRequest import TxRequest
from trezor.messages.RequestType import TXINPUT, TXOUTPUT, TXMETA, TXFINISHED
from trezor.messages.TxRequestDetailsType import TxRequestDetailsType
@ -43,19 +43,19 @@ class TestSignTx_GRS(unittest.TestCase):
coin = coins.by_name('Groestlcoin')
ptx1 = TxAckPrevTxType(version=1, lock_time=2160993, inputs_count=1, outputs_count=1, extra_data_len=0)
pinp1 = TxAckPrevInputType(script_sig=unhexlify('48304502210096a287593b1212a188e778596eb8ecd4cc169b93a4d115226460d8e3deae431c02206c78ec09b3df977f04a6df5eb53181165c4ea5a0b35f826551349130f879d6b8012102cf5126ff54e38a80a919579d7091cafe24840eab1d30fe2b4d59bdd9d267cad8'),
ptx1 = PrevTx(version=1, lock_time=2160993, inputs_count=1, outputs_count=1, extra_data_len=0)
pinp1 = PrevInput(script_sig=unhexlify('48304502210096a287593b1212a188e778596eb8ecd4cc169b93a4d115226460d8e3deae431c02206c78ec09b3df977f04a6df5eb53181165c4ea5a0b35f826551349130f879d6b8012102cf5126ff54e38a80a919579d7091cafe24840eab1d30fe2b4d59bdd9d267cad8'),
prev_hash=unhexlify('7dc74a738c50c2ae1228ce9890841e5355fd6d7f2c1367e0a74403ab60db3224'),
prev_index=0,
sequence=4294967294)
pout1 = TxAckPrevOutputType(script_pubkey=unhexlify('76a914172b4e06e9b7881a48d2ee8062b495d0b2517fe888ac'),
pout1 = PrevOutput(script_pubkey=unhexlify('76a914172b4e06e9b7881a48d2ee8062b495d0b2517fe888ac'),
amount=210016)
inp1 = TxAckInputType(address_n=[44 | 0x80000000, 17 | 0x80000000, 0 | 0x80000000, 0, 2], # FXHDsC5ZqWQHkDmShzgRVZ1MatpWhwxTAA
inp1 = TxInput(address_n=[44 | 0x80000000, 17 | 0x80000000, 0 | 0x80000000, 0, 2], # FXHDsC5ZqWQHkDmShzgRVZ1MatpWhwxTAA
prev_hash=unhexlify('cb74c8478c5814742c87cffdb4a21231869888f8042fb07a90e015a9db1f9d4a'),
prev_index=0,
amount=210016)
out1 = TxAckOutputType(address='FtM4zAn9aVYgHgxmamWBgWPyZsb6RhvkA9',
out1 = TxOutput(address='FtM4zAn9aVYgHgxmamWBgWPyZsb6RhvkA9',
amount=210016 - 192,
script_type=OutputScriptType.PAYTOADDRESS,
address_n=[])

@ -1,7 +1,7 @@
from common import *
from trezor.messages.TxAckInputType import TxAckInputType
from trezor.messages.TxAckOutputType import TxAckOutputType
from trezor.messages.TxInput import TxInput
from trezor.messages.TxOutput import TxOutput
from trezor.messages import OutputScriptType
from trezor.crypto import bip32, bip39
@ -18,7 +18,7 @@ class TestCalculateTxWeight(unittest.TestCase):
coin = coins.by_name('Bitcoin')
seed = bip39.seed(' '.join(['all'] * 12), '')
inp1 = TxAckInputType(address_n=[0], # 14LmW5k4ssUrtbAB4255zdqv3b4w1TuX9e
inp1 = TxInput(address_n=[0], # 14LmW5k4ssUrtbAB4255zdqv3b4w1TuX9e
# amount=390000,
prev_hash=unhexlify('d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882'),
prev_index=0,
@ -26,7 +26,7 @@ class TestCalculateTxWeight(unittest.TestCase):
script_type=InputScriptType.SPENDADDRESS,
sequence=0xffff_ffff,
multisig=None)
out1 = TxAckOutputType(address='1MJ2tj2ThBE62zXbBYA5ZaN3fdve5CPAz1',
out1 = TxOutput(address='1MJ2tj2ThBE62zXbBYA5ZaN3fdve5CPAz1',
amount=390000 - 10000,
script_type=OutputScriptType.PAYTOADDRESS,
address_n=[],
@ -46,7 +46,7 @@ class TestCalculateTxWeight(unittest.TestCase):
coin = coins.by_name('Testnet')
seed = bip39.seed(' '.join(['all'] * 12), '')
inp1 = TxAckInputType(
inp1 = TxInput(
# 49'/1'/0'/1/0" - 2N1LGaGg836mqSQqiuUBLfcyGBhyZbremDX
address_n=[49 | 0x80000000, 1 | 0x80000000, 0 | 0x80000000, 1, 0],
amount=123456789,
@ -56,14 +56,14 @@ class TestCalculateTxWeight(unittest.TestCase):
sequence=0xffffffff,
multisig=None,
)
out1 = TxAckOutputType(
out1 = TxOutput(
address='mhRx1CeVfaayqRwq5zgRQmD7W5aWBfD5mC',
amount=12300000,
script_type=OutputScriptType.PAYTOADDRESS,
address_n=[],
multisig=None,
)
out2 = TxAckOutputType(
out2 = TxOutput(
address='2N1LGaGg836mqSQqiuUBLfcyGBhyZbremDX',
script_type=OutputScriptType.PAYTOADDRESS,
amount=123456789 - 11000 - 12300000,
@ -86,7 +86,7 @@ class TestCalculateTxWeight(unittest.TestCase):
coin = coins.by_name('Testnet')
seed = bip39.seed(' '.join(['all'] * 12), '')
inp1 = TxAckInputType(
inp1 = TxInput(
# 49'/1'/0'/0/0" - tb1qqzv60m9ajw8drqulta4ld4gfx0rdh82un5s65s
address_n=[49 | 0x80000000, 1 | 0x80000000, 0 | 0x80000000, 0, 0],
amount=12300000,
@ -96,14 +96,14 @@ class TestCalculateTxWeight(unittest.TestCase):
sequence=0xffffffff,
multisig=None,
)
out1 = TxAckOutputType(
out1 = TxOutput(
address='2N4Q5FhU2497BryFfUgbqkAJE87aKHUhXMp',
amount=5000000,
script_type=OutputScriptType.PAYTOADDRESS,
address_n=[],
multisig=None,
)
out2 = TxAckOutputType(
out2 = TxOutput(
address='tb1q694ccp5qcc0udmfwgp692u2s2hjpq5h407urtu',
script_type=OutputScriptType.PAYTOADDRESS,
amount=12300000 - 11000 - 5000000,

@ -1,8 +1,8 @@
from common import *
from trezor.messages import InputScriptType
from trezor.messages.SignTx import SignTx
from trezor.messages.TxAckInputType import TxAckInputType
from trezor.messages.TxAckPrevOutputType import TxAckPrevOutputType
from trezor.messages.TxInput import TxInput
from trezor.messages.PrevOutput import PrevOutput
from apps.common import coins
from apps.bitcoin.writers import get_tx_hash
@ -194,7 +194,7 @@ class TestZcashZip243(unittest.TestCase):
zip243 = Zcashlike(tx, None, coin, BasicApprover(tx, coin))
for i in v["inputs"]:
txi = TxAckInputType(
txi = TxInput(
amount = i["amount"],
prev_hash = unhexlify(i["prevout"][0]),
prev_index = i["prevout"][1],
@ -203,7 +203,7 @@ class TestZcashZip243(unittest.TestCase):
)
zip243.hash143_add_input(txi)
for o in v["outputs"]:
txo = TxAckPrevOutputType(
txo = PrevOutput(
amount = o["amount"],
script_pubkey = unhexlify(o["script_pubkey"]),
)

@ -70,20 +70,20 @@ AuthorizeCoinJoin.coordinator max_size:18
AuthorizeCoinJoin.address_n max_count:8
AuthorizeCoinJoin.coin_name max_size:21
TxAckInputType.address_n max_count:8
TxAckInputType.prev_hash max_size:32
TxAckInputType.script_sig max_size:1650
TxAckInputType.witness max_size:109
TxAckInputType.ownership_proof max_size:171
TxAckInputType.commitment_data max_size:32
TxInput.address_n max_count:8
TxInput.prev_hash max_size:32
TxInput.script_sig max_size:1650
TxInput.witness max_size:109
TxInput.ownership_proof max_size:171
TxInput.commitment_data max_size:32
TxAckOutputType.address max_size:130
TxAckOutputType.address_n max_count:8
TxAckOutputType.op_return_data max_size:80
TxOutput.address max_size:130
TxOutput.address_n max_count:8
TxOutput.op_return_data max_size:80
TxAckPrevInputType.prev_hash max_size:32
TxAckPrevInputType.script_sig max_size:1650
PrevInput.prev_hash max_size:32
PrevInput.script_sig max_size:1650
TxAckPrevOutputType.script_pubkey max_size:520
PrevOutput.script_pubkey max_size:520
TxAckPrevExtraDataWrapper.extra_data_chunk max_size:1024

@ -10,7 +10,7 @@ if __debug__:
pass
class TxAckPrevInputType(p.MessageType):
class PrevInput(p.MessageType):
def __init__(
self,

@ -10,7 +10,7 @@ if __debug__:
pass
class TxAckPrevOutputType(p.MessageType):
class PrevOutput(p.MessageType):
def __init__(
self,

@ -10,7 +10,7 @@ if __debug__:
pass
class TxAckPrevTxType(p.MessageType):
class PrevTx(p.MessageType):
def __init__(
self,

@ -2,7 +2,7 @@
# fmt: off
from .. import protobuf as p
from .TxAckInputType import TxAckInputType
from .TxInput import TxInput
if __debug__:
try:
@ -17,12 +17,12 @@ class TxAckInputWrapper(p.MessageType):
def __init__(
self,
*,
input: TxAckInputType,
input: TxInput,
) -> None:
self.input = input
@classmethod
def get_fields(cls) -> Dict:
return {
2: ('input', TxAckInputType, p.FLAG_REQUIRED),
2: ('input', TxInput, p.FLAG_REQUIRED),
}

@ -2,7 +2,7 @@
# fmt: off
from .. import protobuf as p
from .TxAckOutputType import TxAckOutputType
from .TxOutput import TxOutput
if __debug__:
try:
@ -17,12 +17,12 @@ class TxAckOutputWrapper(p.MessageType):
def __init__(
self,
*,
output: TxAckOutputType,
output: TxOutput,
) -> None:
self.output = output
@classmethod
def get_fields(cls) -> Dict:
return {
5: ('output', TxAckOutputType, p.FLAG_REQUIRED),
5: ('output', TxOutput, p.FLAG_REQUIRED),
}

@ -2,7 +2,7 @@
# fmt: off
from .. import protobuf as p
from .TxAckPrevInputType import TxAckPrevInputType
from .PrevInput import PrevInput
if __debug__:
try:
@ -17,12 +17,12 @@ class TxAckPrevInputWrapper(p.MessageType):
def __init__(
self,
*,
input: TxAckPrevInputType,
input: PrevInput,
) -> None:
self.input = input
@classmethod
def get_fields(cls) -> Dict:
return {
2: ('input', TxAckPrevInputType, p.FLAG_REQUIRED),
2: ('input', PrevInput, p.FLAG_REQUIRED),
}

@ -2,7 +2,7 @@
# fmt: off
from .. import protobuf as p
from .TxAckPrevTxType import TxAckPrevTxType
from .PrevTx import PrevTx
if __debug__:
try:
@ -18,12 +18,12 @@ class TxAckPrevMeta(p.MessageType):
def __init__(
self,
*,
tx: TxAckPrevTxType,
tx: PrevTx,
) -> None:
self.tx = tx
@classmethod
def get_fields(cls) -> Dict:
return {
1: ('tx', TxAckPrevTxType, p.FLAG_REQUIRED),
1: ('tx', PrevTx, p.FLAG_REQUIRED),
}

@ -2,7 +2,7 @@
# fmt: off
from .. import protobuf as p
from .TxAckPrevOutputType import TxAckPrevOutputType
from .PrevOutput import PrevOutput
if __debug__:
try:
@ -17,12 +17,12 @@ class TxAckPrevOutputWrapper(p.MessageType):
def __init__(
self,
*,
output: TxAckPrevOutputType,
output: PrevOutput,
) -> None:
self.output = output
@classmethod
def get_fields(cls) -> Dict:
return {
3: ('output', TxAckPrevOutputType, p.FLAG_REQUIRED),
3: ('output', PrevOutput, p.FLAG_REQUIRED),
}

@ -13,7 +13,7 @@ if __debug__:
pass
class TxAckInputType(p.MessageType):
class TxInput(p.MessageType):
def __init__(
self,

@ -13,7 +13,7 @@ if __debug__:
pass
class TxAckOutputType(p.MessageType):
class TxOutput(p.MessageType):
def __init__(
self,

@ -214,6 +214,9 @@ from .PinMatrixAck import PinMatrixAck
from .PinMatrixRequest import PinMatrixRequest
from .Ping import Ping
from .PreauthorizedRequest import PreauthorizedRequest
from .PrevInput import PrevInput
from .PrevOutput import PrevOutput
from .PrevTx import PrevTx
from .PublicKey import PublicKey
from .RecoveryDevice import RecoveryDevice
from .ResetDevice import ResetDevice
@ -265,22 +268,19 @@ from .TezosTransactionOp import TezosTransactionOp
from .TransactionType import TransactionType
from .TxAck import TxAck
from .TxAckInput import TxAckInput
from .TxAckInputType import TxAckInputType
from .TxAckInputWrapper import TxAckInputWrapper
from .TxAckOutput import TxAckOutput
from .TxAckOutputType import TxAckOutputType
from .TxAckOutputWrapper import TxAckOutputWrapper
from .TxAckPrevExtraData import TxAckPrevExtraData
from .TxAckPrevExtraDataWrapper import TxAckPrevExtraDataWrapper
from .TxAckPrevInput import TxAckPrevInput
from .TxAckPrevInputType import TxAckPrevInputType
from .TxAckPrevInputWrapper import TxAckPrevInputWrapper
from .TxAckPrevMeta import TxAckPrevMeta
from .TxAckPrevOutput import TxAckPrevOutput
from .TxAckPrevOutputType import TxAckPrevOutputType
from .TxAckPrevOutputWrapper import TxAckPrevOutputWrapper
from .TxAckPrevTxType import TxAckPrevTxType
from .TxInput import TxInput
from .TxInputType import TxInputType
from .TxOutput import TxOutput
from .TxOutputBinType import TxOutputBinType
from .TxOutputType import TxOutputType
from .TxRequest import TxRequest

Loading…
Cancel
Save