1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-18 21:48:13 +00:00

feat(core): Include coin name in CoinJoin fee per vB format.

[no changelog]
This commit is contained in:
Andrew Kozlik 2022-10-25 14:45:30 +02:00 committed by Andrew Kozlik
parent 318d31d111
commit 3c8ba37eb5
3 changed files with 7 additions and 6 deletions

View File

@ -4,7 +4,6 @@ from typing import TYPE_CHECKING
from trezor import ui, wire
from trezor.enums import ButtonRequestType
from trezor.messages import AuthorizeCoinJoin, Success
from trezor.strings import format_amount
from trezor.ui.layouts import confirm_action, confirm_coinjoin, confirm_metadata
from apps.common import authorization, safety_checks
@ -12,7 +11,7 @@ from apps.common.keychain import FORBIDDEN_KEY_PATH
from apps.common.paths import SLIP25_PURPOSE, validate_path
from .authorization import FEE_RATE_DECIMALS
from .common import BIP32_WALLET_DEPTH
from .common import BIP32_WALLET_DEPTH, format_fee_rate
from .keychain import validate_path_against_script_type, with_keychain
if TYPE_CHECKING:
@ -72,14 +71,16 @@ async def authorize_coinjoin(
),
)
max_fee_per_vbyte = format_amount(msg.max_fee_per_kvbyte, 3)
max_fee_per_vbyte = format_fee_rate(
msg.max_fee_per_kvbyte / 1000, coin, include_shortcut=True
)
if msg.max_fee_per_kvbyte > coin.maxfee_kb:
await confirm_metadata(
ctx,
"fee_over_threshold",
"High mining fee",
"The mining fee of\n{} sats/vbyte\nis unexpectedly high.",
"The mining fee of\n{}\nis unexpectedly high.",
max_fee_per_vbyte,
ButtonRequestType.FeeOverThreshold,
)

View File

@ -1013,7 +1013,7 @@ async def confirm_coinjoin(
text.bold(f"{max_rounds}\n")
text.br_half()
text.normal("Maximum mining fee:\n")
text.bold(f"{max_fee_per_vbyte} sats/vbyte")
text.bold(max_fee_per_vbyte)
await raise_if_cancelled(
interact(ctx, HoldToConfirm(text), "coinjoin_final", ButtonRequestType.Other)
)

View File

@ -925,7 +925,7 @@ async def confirm_coinjoin(
_RustLayout(
trezorui2.confirm_coinjoin(
max_rounds=str(max_rounds),
max_feerate=f"{max_fee_per_vbyte} sats/vbyte",
max_feerate=max_fee_per_vbyte,
)
),
"coinjoin_final",