mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-26 17:38:39 +00:00
signtx: fix typo
This commit is contained in:
parent
8d496d456b
commit
72be5cf2f2
@ -305,6 +305,7 @@ def output_derive_script(o: TxOutputType, coin: CoinType, root) -> bytes:
|
|||||||
'Invalid output script type')
|
'Invalid output script type')
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
def check_address_type(address_type, raw_address):
|
def check_address_type(address_type, raw_address):
|
||||||
if address_type <= 0xFF:
|
if address_type <= 0xFF:
|
||||||
return raw_address[0] == address_type
|
return raw_address[0] == address_type
|
||||||
@ -320,6 +321,7 @@ def check_address_type(address_type, raw_address):
|
|||||||
and raw_address[2] == ((address_type >> 8) & 0xFF) \
|
and raw_address[2] == ((address_type >> 8) & 0xFF) \
|
||||||
and raw_address[3] == (address_type & 0xFF)
|
and raw_address[3] == (address_type & 0xFF)
|
||||||
|
|
||||||
|
|
||||||
def output_paytoaddress_extract_raw_address(o: TxOutputType, coin: CoinType, root, p2sh=False) -> bytes:
|
def output_paytoaddress_extract_raw_address(o: TxOutputType, coin: CoinType, root, p2sh=False) -> bytes:
|
||||||
address_type = coin.address_type_p2sh if p2sh else coin.address_type
|
address_type = coin.address_type_p2sh if p2sh else coin.address_type
|
||||||
# TODO: dont encode/decode more then necessary
|
# TODO: dont encode/decode more then necessary
|
||||||
@ -331,13 +333,14 @@ def output_paytoaddress_extract_raw_address(o: TxOutputType, coin: CoinType, roo
|
|||||||
address = getattr(o, 'address', None)
|
address = getattr(o, 'address', None)
|
||||||
if address:
|
if address:
|
||||||
raw = base58.decode_check(address)
|
raw = base58.decode_check(address)
|
||||||
if not check_address_type(address_type, raw_address):
|
if not check_address_type(address_type, raw):
|
||||||
raise SigningError(FailureType.SyntaxError,
|
raise SigningError(FailureType.SyntaxError,
|
||||||
'Invalid address type')
|
'Invalid address type')
|
||||||
return raw
|
return raw
|
||||||
raise SigningError(FailureType.SyntaxError,
|
raise SigningError(FailureType.SyntaxError,
|
||||||
'Missing address')
|
'Missing address')
|
||||||
|
|
||||||
|
|
||||||
def output_is_change(o: TxOutputType):
|
def output_is_change(o: TxOutputType):
|
||||||
address_n = getattr(o, 'address_n', None)
|
address_n = getattr(o, 'address_n', None)
|
||||||
return bool(address_n)
|
return bool(address_n)
|
||||||
|
Loading…
Reference in New Issue
Block a user