1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-07-28 17:38:35 +00:00

style: make style, fix a typo

This commit is contained in:
Tomas Krnak 2022-12-17 18:20:42 +07:00
parent 4e8dcfff80
commit 9db9d3ac40
4 changed files with 23 additions and 14 deletions

View File

@ -45,9 +45,9 @@ async def get_address(ctx: Context, msg: ZcashGetAddress) -> ZcashAddress:
title = address_n_to_str(msg.z_address_n)
address = encode_address(receivers, coin)
elif ( # transparent + shielded, unified path
PathSchema.parse(PATTERN_BIP44, coin.slip44).match(msg.t_address_n) and
PathSchema.parse(PATTERN_ZIP32, coin.slip44).match(msg.z_address_n) and
msg.t_address_n[2] == msg.z_address_n[2]
msg.t_address_n[2] == msg.z_address_n[2] # spending from same account
and PathSchema.parse(PATTERN_BIP44, coin.slip44).match(msg.t_address_n)
and PathSchema.parse(PATTERN_ZIP32, coin.slip44).match(msg.z_address_n)
):
title = "u/{coin_type}/{account}/{receivers}".format(
coin_type=msg.z_address_n[1] ^ HARDENED,
@ -57,17 +57,25 @@ async def get_address(ctx: Context, msg: ZcashGetAddress) -> ZcashAddress:
address = encode_address(receivers, coin)
else: # transparent + shielded, incompatible paths
title = "Unified address"
address_extra = "\n".join((
"Receivers:",
"- transparent",
address_n_to_str(msg.t_address_n),
"- Orchard",
address_n_to_str(msg.z_address_n),
))
address_extra = "\n".join(
(
"Receivers:",
"- transparent",
address_n_to_str(msg.t_address_n),
"- Orchard",
address_n_to_str(msg.z_address_n),
)
)
address = encode_address(receivers, coin)
if msg.show_display:
await show_address(ctx, address=address, address_qr=address, title=title, address_extra=address_extra)
await show_address(
ctx,
address=address,
address_qr=address,
title=title,
address_extra=address_extra,
)
return ZcashAddress(address=address)

View File

@ -88,8 +88,8 @@ class OrchardSigner:
# Constant MAX_SILENT_ORCHARD_INPUTS is chosen heruistically.
# According to the article, shielded transaction with >10 inputs
# are quite unordinary and thus linkable.
#
# Since this attack is not severe, we don't abort.
#
# Since this attack is not severe, we don't abort.
if self.params.inputs_count > MAX_SILENT_ORCHARD_INPUTS:
yield ConfirmOrchardInputsCountOverThreshold(self.params.inputs_count)

View File

@ -13,4 +13,5 @@ if utils.ZCASH_SHIELDED:
to_scalar,
Generators,
)
generators = Generators() # init generators

View File

@ -122,7 +122,7 @@ def sign_tx(
o_outputs = [x for x in outputs if isinstance(x, messages.ZcashOrchardOutput)]
if o_inputs and t_inputs:
raise ValueError("Spending transparent and Orchard funds simultaniously is not supported.")
raise ValueError("Spending transparent and Orchard funds simultaneously is not supported.")
if o_inputs or o_outputs:
if z_address_n is None:
raise ValueError("z_address_n argument is missing")