legacy: implement GetAddress.ignore_xpub_magic

pull/1396/head
Pavol Rusnak 3 years ago
parent e85ed74f8f
commit cb4c5a72bf

@ -237,7 +237,8 @@ static bool fsm_layoutAddress(const char *address, const char *desc,
const uint32_t *address_n, size_t address_n_count,
bool address_is_account,
const MultisigRedeemScriptType *multisig,
int multisig_index, const CoinInfo *coin) {
int multisig_index, uint32_t multisig_xpub_magic,
const CoinInfo *coin) {
int screen = 0, screens = 2;
if (multisig) {
screens += 2 * cryptoMultisigPubkeyCount(multisig);
@ -281,7 +282,7 @@ static bool fsm_layoutAddress(const char *address, const char *desc,
strlcat(xpub, "ERROR", sizeof(xpub));
} else {
hdnode_serialize_public(&node, node_ptr->fingerprint,
coin->xpub_magic, xpub, sizeof(xpub));
multisig_xpub_magic, xpub, sizeof(xpub));
}
}
layoutXPUBMultisig(xpub, index, page, multisig_index == index);

@ -197,13 +197,26 @@ void fsm_msgGetAddress(const GetAddress *msg) {
}
}
uint32_t multisig_xpub_magic = coin->xpub_magic;
if (msg->has_multisig && coin->has_segwit) {
if (!msg->has_ignore_xpub_magic || !msg->ignore_xpub_magic) {
if (msg->script_type == InputScriptType_SPENDWITNESS &&
coin->xpub_magic_segwit_native) {
multisig_xpub_magic = coin->xpub_magic_segwit_native;
} else if (msg->script_type == InputScriptType_SPENDP2SHWITNESS &&
coin->xpub_magic_segwit_p2sh) {
multisig_xpub_magic = coin->xpub_magic_segwit_p2sh;
}
}
}
bool is_cashaddr = coin->cashaddr_prefix != NULL;
bool is_bech32 = msg->script_type == InputScriptType_SPENDWITNESS;
if (!fsm_layoutAddress(address, desc, is_cashaddr || is_bech32,
is_cashaddr ? strlen(coin->cashaddr_prefix) + 1 : 0,
msg->address_n, msg->address_n_count, false,
msg->has_multisig ? &(msg->multisig) : NULL,
multisig_index, coin)) {
multisig_index, multisig_xpub_magic, coin)) {
return;
}
}

@ -120,7 +120,7 @@ void fsm_msgEthereumGetAddress(const EthereumGetAddress *msg) {
strlcpy(desc, "Address:", sizeof(desc));
if (!fsm_layoutAddress(resp->address, desc, false, 0, msg->address_n,
msg->address_n_count, true, NULL, 0, NULL)) {
msg->address_n_count, true, NULL, 0, 0, NULL)) {
return;
}
}

@ -35,7 +35,7 @@ void fsm_msgLiskGetAddress(const LiskGetAddress *msg) {
if (msg->has_show_display && msg->show_display) {
if (!fsm_layoutAddress(resp->address, _("Address:"), true, 0,
msg->address_n, msg->address_n_count, false, NULL, 0,
NULL)) {
0, NULL)) {
return;
}
}

@ -43,7 +43,7 @@ void fsm_msgNEMGetAddress(NEMGetAddress *msg) {
strlcat(desc, ":", sizeof(desc));
if (!fsm_layoutAddress(resp->address, desc, true, 0, msg->address_n,
msg->address_n_count, false, NULL, 0, NULL)) {
msg->address_n_count, false, NULL, 0, 0, NULL)) {
return;
}
}

Loading…
Cancel
Save