1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-05 13:01:12 +00:00

use estimate instead of real size of tx when calculating fee warning

This commit is contained in:
Pavol Rusnak 2014-07-01 19:48:54 +02:00
parent 849e758eb4
commit 9ca3854146
2 changed files with 4 additions and 3 deletions

View File

@ -374,8 +374,9 @@ void signing_txack(TransactionType *tx)
return; return;
} }
uint64_t fee = to_spend - spending; uint64_t fee = to_spend - spending;
if (fee > (((uint64_t)tc.size + 999) / 1000) * coin->maxfee_kb) { uint32_t tx_est_size = transactionEstimateSizeKb(inputs_count, outputs_count);
layoutFeeOverThreshold(coin, fee, ((uint64_t)tc.size + 999) / 1000); if (fee > (uint64_t)tx_est_size * coin->maxfee_kb) {
layoutFeeOverThreshold(coin, fee, tx_est_size);
if (!protectButton(ButtonRequestType_ButtonRequest_FeeOverThreshold, false)) { if (!protectButton(ButtonRequestType_ButtonRequest_FeeOverThreshold, false)) {
fsm_sendFailure(FailureType_Failure_ActionCancelled, "Fee over threshold. Signing cancelled."); fsm_sendFailure(FailureType_Failure_ActionCancelled, "Fee over threshold. Signing cancelled.");
layoutHome(); layoutHome();

@ -1 +1 @@
Subproject commit e588906f811e826c596e631d4dd2500fc38fea60 Subproject commit 3308cc62a64bac76fb475363f9bce83cab1d8381