1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-18 04:18:10 +00:00

fix(legacy): Fix testnet account label in GetAddress dialog.

This commit is contained in:
Andrew Kozlik 2021-11-15 10:02:04 +01:00 committed by Andrew Kozlik
parent 274ccdc4c0
commit f4b8dbefb6
3 changed files with 12 additions and 6 deletions

View File

@ -43,6 +43,12 @@ const CoinInfo *coinByAddressType(uint32_t address_type) {
} }
const CoinInfo *coinBySlip44(uint32_t coin_type) { const CoinInfo *coinBySlip44(uint32_t coin_type) {
if (coin_type == SLIP44_TESTNET) {
// The slip44 coin type is the same for all testnets, so we return the
// Bitcoin Testnet.
return coinByName("Testnet");
}
for (int i = 0; i < COINS_COUNT; i++) { for (int i = 0; i < COINS_COUNT; i++) {
if (coin_type == coins[i].coin_type) { if (coin_type == coins[i].coin_type) {
return &(coins[i]); return &(coins[i]);

View File

@ -59,6 +59,12 @@ typedef struct _CoinInfo {
#include "coin_info.h" #include "coin_info.h"
// SLIP-44 hardened coin type for Bitcoin
#define SLIP44_BITCOIN 0x80000000
// SLIP-44 hardened coin type for all Testnet coins
#define SLIP44_TESTNET 0x80000001
const CoinInfo *coinByName(const char *name); const CoinInfo *coinByName(const char *name);
const CoinInfo *coinByAddressType(uint32_t address_type); const CoinInfo *coinByAddressType(uint32_t address_type);
const CoinInfo *coinBySlip44(uint32_t coin_type); const CoinInfo *coinBySlip44(uint32_t coin_type);

View File

@ -37,12 +37,6 @@
#define PATH_MAX_CHANGE 1 #define PATH_MAX_CHANGE 1
#define PATH_MAX_ADDRESS_INDEX 1000000 #define PATH_MAX_ADDRESS_INDEX 1000000
// SLIP-44 hardened coin type for Bitcoin
#define SLIP44_BITCOIN 0x80000000
// SLIP-44 hardened coin type for all Testnet coins
#define SLIP44_TESTNET 0x80000001
uint32_t ser_length(uint32_t len, uint8_t *out) { uint32_t ser_length(uint32_t len, uint8_t *out) {
if (len < 253) { if (len < 253) {
out[0] = len & 0xFF; out[0] = len & 0xFF;