diff --git a/src/apps/ethereum/get_address.py b/src/apps/ethereum/get_address.py index bd45571b23..fb6ecf2a21 100644 --- a/src/apps/ethereum/get_address.py +++ b/src/apps/ethereum/get_address.py @@ -8,21 +8,19 @@ async def get_address(ctx, msg): from trezor.crypto.hashlib import sha3_256 from apps.common import seed - address_n = msg.address_n or () - - node = await seed.derive_node(ctx, address_n) + node = await seed.derive_node(ctx, msg.address_n) seckey = node.private_key() public_key = secp256k1.publickey(seckey, False) # uncompressed address = sha3_256(public_key[1:], keccak=True).digest()[12:] if msg.show_display: - if len(address_n) > 1: # path has slip44 network identifier - network = networks.by_slip44(address_n[1] & 0x7FFFFFFF) + if len(msg.address_n) > 1: # path has slip44 network identifier + network = networks.by_slip44(msg.address_n[1] & 0x7FFFFFFF) else: network = None hex_addr = _ethereum_address_hex(address, network) - desc = address_n_to_str(address_n) + desc = address_n_to_str(msg.address_n) while True: if await show_address(ctx, hex_addr, desc=desc): break diff --git a/src/apps/ethereum/sign_message.py b/src/apps/ethereum/sign_message.py index 618eed85da..58b606f7fc 100644 --- a/src/apps/ethereum/sign_message.py +++ b/src/apps/ethereum/sign_message.py @@ -21,8 +21,7 @@ def message_digest(message): async def sign_message(ctx, msg): await require_confirm_sign_message(ctx, msg.message) - address_n = msg.address_n or () - node = await seed.derive_node(ctx, address_n) + node = await seed.derive_node(ctx, msg.address_n) signature = secp256k1.sign( node.private_key(), diff --git a/src/apps/ethereum/sign_tx.py b/src/apps/ethereum/sign_tx.py index 576ebb7828..b8acd558e6 100644 --- a/src/apps/ethereum/sign_tx.py +++ b/src/apps/ethereum/sign_tx.py @@ -128,8 +128,7 @@ async def send_request_chunk(ctx, data_left: int): async def send_signature(ctx, msg: EthereumSignTx, digest): - address_n = msg.address_n or () - node = await seed.derive_node(ctx, address_n) + node = await seed.derive_node(ctx, msg.address_n) signature = secp256k1.sign( node.private_key(), digest, False, secp256k1.CANONICAL_SIG_ETHEREUM diff --git a/src/apps/lisk/get_address.py b/src/apps/lisk/get_address.py index 26f39cd574..27b2968cce 100644 --- a/src/apps/lisk/get_address.py +++ b/src/apps/lisk/get_address.py @@ -7,15 +7,13 @@ from apps.common.layout import address_n_to_str, show_address, show_qr async def get_address(ctx, msg): - address_n = msg.address_n or () - - node = await seed.derive_node(ctx, address_n, LISK_CURVE) + node = await seed.derive_node(ctx, msg.address_n, LISK_CURVE) pubkey = node.public_key() pubkey = pubkey[1:] # skip ed25519 pubkey marker address = get_address_from_public_key(pubkey) if msg.show_display: - desc = address_n_to_str(address_n) + desc = address_n_to_str(msg.address_n) while True: if await show_address(ctx, address, desc=desc): break diff --git a/src/apps/lisk/get_public_key.py b/src/apps/lisk/get_public_key.py index 740d47c643..6fc35aadff 100644 --- a/src/apps/lisk/get_public_key.py +++ b/src/apps/lisk/get_public_key.py @@ -6,9 +6,7 @@ from apps.common import layout, seed async def get_public_key(ctx, msg): - address_n = msg.address_n or () - - node = await seed.derive_node(ctx, address_n, LISK_CURVE) + node = await seed.derive_node(ctx, msg.address_n, LISK_CURVE) pubkey = node.public_key() pubkey = pubkey[1:] # skip ed25519 pubkey marker diff --git a/src/apps/lisk/sign_message.py b/src/apps/lisk/sign_message.py index 109319023b..4be9996c37 100644 --- a/src/apps/lisk/sign_message.py +++ b/src/apps/lisk/sign_message.py @@ -24,7 +24,7 @@ def message_digest(message): async def sign_message(ctx, msg): message = msg.message - address_n = msg.address_n or () + address_n = msg.address_n await require_confirm_sign_message(ctx, message) diff --git a/src/apps/lisk/sign_tx.py b/src/apps/lisk/sign_tx.py index bcbfbe5677..7c59fdfea0 100644 --- a/src/apps/lisk/sign_tx.py +++ b/src/apps/lisk/sign_tx.py @@ -36,8 +36,7 @@ async def sign_tx(ctx, msg): async def _get_keys(ctx, msg): - address_n = msg.address_n or () - node = await seed.derive_node(ctx, address_n, LISK_CURVE) + node = await seed.derive_node(ctx, msg.address_n, LISK_CURVE) seckey = node.private_key() pubkey = node.public_key() diff --git a/src/apps/tezos/get_address.py b/src/apps/tezos/get_address.py index a0389d2d9f..07ded8153d 100644 --- a/src/apps/tezos/get_address.py +++ b/src/apps/tezos/get_address.py @@ -11,8 +11,7 @@ from apps.tezos.helpers import ( async def get_address(ctx, msg): - address_n = msg.address_n or () - node = await seed.derive_node(ctx, address_n, TEZOS_CURVE) + node = await seed.derive_node(ctx, msg.address_n, TEZOS_CURVE) pk = seed.remove_ed25519_prefix(node.public_key()) pkh = hashlib.blake2b(pk, outlen=20).digest() diff --git a/src/apps/tezos/get_public_key.py b/src/apps/tezos/get_public_key.py index 964944ce01..b229a4aa92 100644 --- a/src/apps/tezos/get_public_key.py +++ b/src/apps/tezos/get_public_key.py @@ -10,8 +10,7 @@ from apps.tezos.helpers import TEZOS_CURVE, TEZOS_PUBLICKEY_PREFIX, base58_encod async def get_public_key(ctx, msg): - address_n = msg.address_n or () - node = await seed.derive_node(ctx, address_n, TEZOS_CURVE) + node = await seed.derive_node(ctx, msg.address_n, TEZOS_CURVE) pk = seed.remove_ed25519_prefix(node.public_key()) pk_prefixed = base58_encode_check(pk, prefix=TEZOS_PUBLICKEY_PREFIX) diff --git a/src/apps/tezos/sign_tx.py b/src/apps/tezos/sign_tx.py index 02036ab49e..ffb86c5b6e 100644 --- a/src/apps/tezos/sign_tx.py +++ b/src/apps/tezos/sign_tx.py @@ -16,8 +16,7 @@ from apps.tezos.helpers import ( async def sign_tx(ctx, msg): - address_n = msg.address_n or () - node = await seed.derive_node(ctx, address_n, TEZOS_CURVE) + node = await seed.derive_node(ctx, msg.address_n, TEZOS_CURVE) if msg.transaction is not None: to = _get_address_from_contract(msg.transaction.destination)