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

feat(legacy): do not convert bech32 addresses to uppercase for QR code

feat(legacy): maintain big QR code for taproot addresses
This commit is contained in:
grdddj 2022-08-30 11:02:36 +02:00 committed by Jiří Musil
parent e3d5c178f1
commit 093be69dfb
3 changed files with 8 additions and 5 deletions

View File

@ -0,0 +1 @@
Do not convert bech32 addresses to uppercase in QR code to increase compatibility

View File

@ -253,9 +253,7 @@ void fsm_msgGetAddress(const GetAddress *msg) {
} }
bool is_cashaddr = coin->cashaddr_prefix != NULL; bool is_cashaddr = coin->cashaddr_prefix != NULL;
bool is_bech32 = msg->script_type == InputScriptType_SPENDWITNESS || if (!fsm_layoutAddress(address, desc, is_cashaddr,
msg->script_type == InputScriptType_SPENDTAPROOT;
if (!fsm_layoutAddress(address, desc, is_cashaddr || is_bech32,
is_cashaddr ? strlen(coin->cashaddr_prefix) + 1 : 0, is_cashaddr ? strlen(coin->cashaddr_prefix) + 1 : 0,
msg->address_n, msg->address_n_count, false, msg->address_n, msg->address_n_count, false,
msg->has_multisig ? &(msg->multisig) : NULL, msg->has_multisig ? &(msg->multisig) : NULL,

View File

@ -787,8 +787,12 @@ void layoutAddress(const char *address, const char *desc, bool qrcode,
} }
oledInvert(0, 0, 63, 63); oledInvert(0, 0, 63, 63);
if (side > 0 && side <= 29) { if (side > 0 && side <= 33) {
int offset = 32 - side; // For QR code V4 (33x33), still maintaining two pixels per module
// so that it is nicely readable. Not showing the bottom row,
// which is not a problem thanks to the QR code's error correction.
// It is a use-case for BTC taproot addresses.
int offset = side <= 29 ? 32 - side : 0;
for (int i = 0; i < side; i++) { for (int i = 0; i < side; i++) {
for (int j = 0; j < side; j++) { for (int j = 0; j < side; j++) {
if (qrcodegen_getModule(codedata, i, j)) { if (qrcodegen_getModule(codedata, i, j)) {