feat(legacy): Display nLockTime in human-readable form.

pull/1552/head
Andrew Kozlik 3 years ago committed by Andrew Kozlik
parent a9b8b0e119
commit a755e99ccc

@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Changed ### Changed
- Allow decreasing the output value in RBF transactions. [#1491] - Allow decreasing the output value in RBF transactions. [#1491]
- Support long PIN of up to 50 digits. [#1167] - Support long PIN of up to 50 digits. [#1167]
- Display nLockTime in human-readable form. [#1549]
### Deprecated ### Deprecated
@ -384,3 +385,4 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
[#1415]: https://github.com/trezor/trezor-firmware/pull/1415 [#1415]: https://github.com/trezor/trezor-firmware/pull/1415
[#1491]: https://github.com/trezor/trezor-firmware/issues/1491 [#1491]: https://github.com/trezor/trezor-firmware/issues/1491
[#1518]: https://github.com/trezor/trezor-firmware/pull/1518 [#1518]: https://github.com/trezor/trezor-firmware/pull/1518
[#1549]: https://github.com/trezor/trezor-firmware/issues/1549

@ -22,6 +22,7 @@
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <time.h>
#include "bignum.h" #include "bignum.h"
#include "bitmaps.h" #include "bitmaps.h"
@ -584,10 +585,17 @@ void layoutConfirmNondefaultLockTime(uint32_t lock_time,
_("will have no effect."), NULL, _("Continue?"), NULL); _("will have no effect."), NULL, _("Continue?"), NULL);
} else { } else {
char str_locktime[11] = {0}; char str_locktime[20] = {0};
snprintf(str_locktime, sizeof(str_locktime), "%" PRIu32, lock_time); char *str_type = NULL;
char *str_type = (lock_time < LOCKTIME_TIMESTAMP_MIN_VALUE) ? "blockheight:" if (lock_time < LOCKTIME_TIMESTAMP_MIN_VALUE) {
: "timestamp:"; str_type = "blockheight:";
snprintf(str_locktime, sizeof(str_locktime), "%" PRIu32, lock_time);
} else {
str_type = "timestamp (UTC):";
time_t time = lock_time;
const struct tm *tm = gmtime(&time);
strftime(str_locktime, sizeof(str_locktime), "%F %T", tm);
}
layoutDialogSwipe(&bmp_icon_question, _("Cancel"), _("Confirm"), NULL, layoutDialogSwipe(&bmp_icon_question, _("Cancel"), _("Confirm"), NULL,
_("Locktime for this"), _("transaction is set to"), _("Locktime for this"), _("transaction is set to"),

Loading…
Cancel
Save