mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-14 10:38:09 +00:00
src/apps/wallet: fix address_n_matches_coin function
This commit is contained in:
parent
43891692ab
commit
ac0bdd5902
@ -617,10 +617,11 @@ def node_derive(root: bip32.HDNode, address_n: list) -> bip32.HDNode:
|
|||||||
|
|
||||||
|
|
||||||
def address_n_matches_coin(address_n: list, coin: CoinInfo) -> bool:
|
def address_n_matches_coin(address_n: list, coin: CoinInfo) -> bool:
|
||||||
bip44 = const(44 | 0x80000000)
|
if len(address_n) < 2:
|
||||||
if len(address_n) < 2 or address_n[0] != bip44 or address_n[1] == coin.slip44 | 0x80000000:
|
return True # path is too short
|
||||||
return True # path is not BIP44 or matches the coin
|
if address_n[0] not in (44 | 0x80000000, 49 | 0x80000000, 84 | 0x80000000):
|
||||||
return False # path is BIP44 and does not match the coin
|
return True # path is not BIP44/49/84
|
||||||
|
return address_n[1] == (coin.slip44 | 0x80000000) # check whether coin_type matches slip44 value
|
||||||
|
|
||||||
|
|
||||||
def ecdsa_sign(node: bip32.HDNode, digest: bytes) -> bytes:
|
def ecdsa_sign(node: bip32.HDNode, digest: bytes) -> bytes:
|
||||||
|
Loading…
Reference in New Issue
Block a user