From eacaffd07934f00562aec9494b122f86098b98b5 Mon Sep 17 00:00:00 2001 From: matejcik Date: Thu, 14 Oct 2021 16:17:44 +0200 Subject: [PATCH] fix(core/ethereum): use built-in ethereum_pubkeyhash() in get_address --- core/src/apps/ethereum/get_address.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/core/src/apps/ethereum/get_address.py b/core/src/apps/ethereum/get_address.py index 6275af7ea..c2fe8eac6 100644 --- a/core/src/apps/ethereum/get_address.py +++ b/core/src/apps/ethereum/get_address.py @@ -1,5 +1,3 @@ -from trezor.crypto.curve import secp256k1 -from trezor.crypto.hashlib import sha3_256 from trezor.messages import EthereumAddress from trezor.ui.layouts import show_address @@ -23,15 +21,12 @@ async def get_address( await paths.validate_path(ctx, keychain, msg.address_n) node = keychain.derive(msg.address_n) - seckey = node.private_key() - public_key = secp256k1.publickey(seckey, False) # uncompressed - address_bytes = sha3_256(public_key[1:], keccak=True).digest()[12:] if len(msg.address_n) > 1: # path has slip44 network identifier network = networks.by_slip44(msg.address_n[1] & 0x7FFF_FFFF) else: network = None - address = address_from_bytes(address_bytes, network) + address = address_from_bytes(node.ethereum_pubkeyhash(), network) if msg.show_display: title = paths.address_n_to_str(msg.address_n)