diff --git a/legacy/firmware/.changelog.d/2442.added b/legacy/firmware/.changelog.d/2442.added new file mode 100644 index 000000000..c9b38f712 --- /dev/null +++ b/legacy/firmware/.changelog.d/2442.added @@ -0,0 +1 @@ +Show fee rate when replacing transaction diff --git a/legacy/firmware/layout2.c b/legacy/firmware/layout2.c index 181bd6038..5334ff779 100644 --- a/legacy/firmware/layout2.c +++ b/legacy/firmware/layout2.c @@ -586,7 +586,8 @@ void layoutConfirmModifyOutput(const CoinInfo *coin, AmountUnit amount_unit, } void layoutConfirmModifyFee(const CoinInfo *coin, AmountUnit amount_unit, - uint64_t fee_old, uint64_t fee_new) { + uint64_t fee_old, uint64_t fee_new, + uint64_t tx_weight) { char str_fee_change[32] = {0}; char str_fee_new[32] = {0}; char *question = NULL; @@ -605,9 +606,14 @@ void layoutConfirmModifyFee(const CoinInfo *coin, AmountUnit amount_unit, format_coin_amount(fee_new, NULL, coin, amount_unit, str_fee_new, sizeof(str_fee_new)); + char str_fee_rate[32] = {0}; + + formatFeeRate(fee_new, tx_weight, str_fee_rate, sizeof(str_fee_rate), + coin->has_segwit); + layoutDialogSwipe(&bmp_icon_question, _("Cancel"), _("Confirm"), NULL, - question, str_fee_change, NULL, _("Transaction fee:"), - str_fee_new, NULL); + question, str_fee_change, _("Transaction fee:"), + str_fee_new, str_fee_rate, NULL); } void layoutFeeOverThreshold(const CoinInfo *coin, AmountUnit amount_unit, diff --git a/legacy/firmware/layout2.h b/legacy/firmware/layout2.h index 7f88da70f..6a0195680 100644 --- a/legacy/firmware/layout2.h +++ b/legacy/firmware/layout2.h @@ -64,7 +64,8 @@ void layoutConfirmModifyOutput(const CoinInfo *coin, AmountUnit amount_unit, TxOutputType *out, TxOutputType *orig_out, int page); void layoutConfirmModifyFee(const CoinInfo *coin, AmountUnit amount_unit, - uint64_t fee_old, uint64_t fee_new); + uint64_t fee_old, uint64_t fee_new, + uint64_t tx_weight); void layoutFeeOverThreshold(const CoinInfo *coin, AmountUnit amount_unit, uint64_t fee); void layoutChangeCountOverThreshold(uint32_t change_count); diff --git a/legacy/firmware/signing.c b/legacy/firmware/signing.c index 2d5bb663c..dcdc6806e 100644 --- a/legacy/firmware/signing.c +++ b/legacy/firmware/signing.c @@ -1998,7 +1998,7 @@ static bool signing_confirm_tx(void) { // Fee modification. if (fee != orig_fee) { - layoutConfirmModifyFee(coin, amount_unit, orig_fee, fee); + layoutConfirmModifyFee(coin, amount_unit, orig_fee, fee, tx_weight); if (!protectButton(ButtonRequestType_ButtonRequest_SignTx, false)) { fsm_sendFailure(FailureType_Failure_ActionCancelled, NULL); signing_abort(); diff --git a/tests/ui_tests/fixtures.json b/tests/ui_tests/fixtures.json index ef001b899..6a934aaf0 100644 --- a/tests/ui_tests/fixtures.json +++ b/tests/ui_tests/fixtures.json @@ -275,14 +275,14 @@ "T1_bitcoin-test_signtx_prevhash.py::test_invalid_prev_hash_in_prevtx[xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx]": "1f8e0bd62be3e6bccbe83fb0589760364f90de7eef7e718d1741fb2591462d75", "T1_bitcoin-test_signtx_replacement.py::test_attack_fake_int_input_amount": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "T1_bitcoin-test_signtx_replacement.py::test_attack_steal_change": "3a79850fe95abbd2ca342fc62ba7f6404c4f437977764839a8146789ac811fce", -"T1_bitcoin-test_signtx_replacement.py::test_p2pkh_fee_bump": "a386c4c61f5fe3b073db6b8725193f5bf7881d7b6fae175ff7d879f7c94eb795", -"T1_bitcoin-test_signtx_replacement.py::test_p2tr_fee_bump": "00f4f745f88f1072f495e513d6a7747db494bb7c785c32d167652fe1d79509be", -"T1_bitcoin-test_signtx_replacement.py::test_p2tr_invalid_signature": "00f4f745f88f1072f495e513d6a7747db494bb7c785c32d167652fe1d79509be", -"T1_bitcoin-test_signtx_replacement.py::test_p2wpkh_finalize": "7b3b6ebee78fed0e64c9689c64c5fbf73099812c5452b2fd2dbe2c23cd69b669", -"T1_bitcoin-test_signtx_replacement.py::test_p2wpkh_in_p2sh_fee_bump_from_external": "3d7d6ad6eafe3399f9d3aa5bb358e4c04f83a98b68ccfa8a124b7e63c0f6df78", -"T1_bitcoin-test_signtx_replacement.py::test_p2wpkh_in_p2sh_remove_change": "14544554428651eb22515a88418c71f66de68e581ea2df5b2259843b1931e8fc", -"T1_bitcoin-test_signtx_replacement.py::test_p2wpkh_invalid_signature": "7b3b6ebee78fed0e64c9689c64c5fbf73099812c5452b2fd2dbe2c23cd69b669", -"T1_bitcoin-test_signtx_replacement.py::test_p2wpkh_op_return_fee_bump": "897291942225c61f9b641c7a1287960e7c21d80ada6c75414399d76edc41054c", +"T1_bitcoin-test_signtx_replacement.py::test_p2pkh_fee_bump": "6ce87a239e06fef8eafc8b3e2ae7212c000c648d40c77da0667d95db23770f9a", +"T1_bitcoin-test_signtx_replacement.py::test_p2tr_fee_bump": "10bad1ccf61c18d7b6157b26fa02e44962f5540852a04987f8059931e2315086", +"T1_bitcoin-test_signtx_replacement.py::test_p2tr_invalid_signature": "10bad1ccf61c18d7b6157b26fa02e44962f5540852a04987f8059931e2315086", +"T1_bitcoin-test_signtx_replacement.py::test_p2wpkh_finalize": "071c96658afcaecddc21aefea47e689d798a82c37600e02a95f6ecb15de269ce", +"T1_bitcoin-test_signtx_replacement.py::test_p2wpkh_in_p2sh_fee_bump_from_external": "807ab01362899bbfe2f557faca14b6c7317715021f8dd3dc1deedd20e14e3b80", +"T1_bitcoin-test_signtx_replacement.py::test_p2wpkh_in_p2sh_remove_change": "50423223ee864ad5d3fd00c91774ea5b437ecfa61538a32f24f4f937419b213b", +"T1_bitcoin-test_signtx_replacement.py::test_p2wpkh_invalid_signature": "071c96658afcaecddc21aefea47e689d798a82c37600e02a95f6ecb15de269ce", +"T1_bitcoin-test_signtx_replacement.py::test_p2wpkh_op_return_fee_bump": "05b9b5f506ef984d798aed1c51299181431881d6098a595bc0a886f22b4422fb", "T1_bitcoin-test_signtx_segwit.py::test_attack_change_input_address": "ddd46015ad9e958929a0fe9ad37a5aa07944807f08be6d3f9c3086c4876f6af4", "T1_bitcoin-test_signtx_segwit.py::test_attack_mixed_inputs": "05fba4bc7c52f1ae8154b8d55d52795900b7e1598a1d965200d36b5f44f93ccd", "T1_bitcoin-test_signtx_segwit.py::test_send_multisig_1": "4799cbd3de2dad5255880a807f15d9d0d857b2ca0bb1afb287a4810964144833",