mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 15:38:11 +00:00
Improved backwards compatibility of GetFeatures
Set all CoinType fields except signed_message_header. Move static assert into the function where it is needed.
This commit is contained in:
parent
b5fa8a266a
commit
1566631023
@ -208,8 +208,6 @@ void fsm_msgInitialize(Initialize *msg)
|
||||
fsm_msgGetFeatures(0);
|
||||
}
|
||||
|
||||
_Static_assert(pb_arraysize(Features, coins) >= COINS_COUNT, "Features.coins max_count not large enough");
|
||||
|
||||
void fsm_msgGetFeatures(GetFeatures *msg)
|
||||
{
|
||||
(void)msg;
|
||||
@ -234,12 +232,32 @@ void fsm_msgGetFeatures(GetFeatures *msg)
|
||||
resp->has_label = true;
|
||||
strlcpy(resp->label, storage.label, sizeof(resp->label));
|
||||
}
|
||||
|
||||
_Static_assert(pb_arraysize(Features, coins) >= COINS_COUNT, "Features.coins max_count not large enough");
|
||||
resp->coins_count = COINS_COUNT;
|
||||
for (int i = 0; i < COINS_COUNT; i++) {
|
||||
resp->coins[i].has_coin_name = true;
|
||||
strlcpy(resp->coins[i].coin_name, coins[i].coin_name, sizeof(resp->coins[i].coin_name));
|
||||
if (coins[i].coin_name) {
|
||||
resp->coins[i].has_coin_name = true;
|
||||
strlcpy(resp->coins[i].coin_name, coins[i].coin_name, sizeof(resp->coins[i].coin_name));
|
||||
}
|
||||
if (coins[i].coin_shortcut) {
|
||||
resp->coins[i].has_coin_shortcut = true;
|
||||
strlcpy(resp->coins[i].coin_shortcut, coins[i].coin_shortcut, sizeof(resp->coins[i].coin_shortcut));
|
||||
}
|
||||
resp->coins[i].has_address_type = coins[i].has_address_type;
|
||||
resp->coins[i].address_type = coins[i].address_type;
|
||||
resp->coins[i].has_maxfee_kb = true;
|
||||
resp->coins[i].maxfee_kb = coins[i].maxfee_kb;
|
||||
resp->coins[i].has_address_type_p2sh = coins[i].has_address_type_p2sh;
|
||||
resp->coins[i].address_type_p2sh = coins[i].address_type_p2sh;
|
||||
resp->coins[i].has_xpub_magic = coins[i].xpub_magic != 0;
|
||||
resp->coins[i].xpub_magic = coins[i].xpub_magic;
|
||||
resp->coins[i].has_xprv_magic = coins[i].xprv_magic != 0;
|
||||
resp->coins[i].xprv_magic = coins[i].xprv_magic;
|
||||
resp->coins[i].has_segwit = true;
|
||||
resp->coins[i].segwit = coins[i].has_segwit;
|
||||
resp->coins[i].has_forkid = coins[i].has_forkid;
|
||||
resp->coins[i].forkid = coins[i].forkid;
|
||||
}
|
||||
resp->has_initialized = true; resp->initialized = storage_isInitialized();
|
||||
resp->has_imported = true; resp->imported = storage.has_imported && storage.imported;
|
||||
|
Loading…
Reference in New Issue
Block a user