From 6c2c99688b5b0fb2a9f114b5e5b232b1c1a38e7c Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Mon, 11 Jun 2018 13:46:26 +0200 Subject: [PATCH] src/apps/wallet: drop cashaddr prefix from the ui --- src/apps/wallet/get_address.py | 3 ++- src/apps/wallet/sign_tx/layout.py | 3 ++- src/apps/wallet/verify_message.py | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/apps/wallet/get_address.py b/src/apps/wallet/get_address.py index 31c97587d2..06ec4f8629 100644 --- a/src/apps/wallet/get_address.py +++ b/src/apps/wallet/get_address.py @@ -17,10 +17,11 @@ async def get_address(ctx, msg): node = await seed.derive_node(ctx, msg.address_n) address = addresses.get_address(msg.script_type, coin, node, msg.multisig) + address_short = address[len(coin.cashaddr_prefix) + 1:] if coin.cashaddr_prefix is not None else address if msg.show_display: while True: - if await _show_address(ctx, address): + if await _show_address(ctx, address_short): break if await _show_qr(ctx, address.upper() if msg.script_type == InputScriptType.SPENDWITNESS else address): break diff --git a/src/apps/wallet/sign_tx/layout.py b/src/apps/wallet/sign_tx/layout.py index 324a6b0c47..b4e4e9bda0 100644 --- a/src/apps/wallet/sign_tx/layout.py +++ b/src/apps/wallet/sign_tx/layout.py @@ -29,9 +29,10 @@ async def confirm_output(ctx, output, coin): ui.MONO, *split_op_return(data), icon_color=ui.GREEN) else: address = output.address + address_short = address[len(coin.cashaddr_prefix) + 1:] if coin.cashaddr_prefix is not None else address content = Text('Confirm sending', ui.ICON_SEND, ui.NORMAL, format_coin_amount(output.amount, coin) + ' to', - ui.MONO, *split_address(address), icon_color=ui.GREEN) + ui.MONO, *split_address(address_short), icon_color=ui.GREEN) return await confirm(ctx, content, ButtonRequestType.ConfirmOutput) diff --git a/src/apps/wallet/verify_message.py b/src/apps/wallet/verify_message.py index b968152806..9160a70bb6 100644 --- a/src/apps/wallet/verify_message.py +++ b/src/apps/wallet/verify_message.py @@ -51,7 +51,9 @@ async def verify_message(ctx, msg): if addr != address: raise wire.ProcessError('Invalid signature') - await require_confirm_verify_message(ctx, address, message) + address_short = address[len(coin.cashaddr_prefix) + 1:] if coin.cashaddr_prefix is not None else address + + await require_confirm_verify_message(ctx, address_short, message) return Success(message='Message verified')