mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-02 19:40:57 +00:00
feat(core): introduce PATTERN_BIP86 to keychain
This commit is contained in:
parent
ae41f7dec8
commit
6406f0640d
@ -46,6 +46,8 @@ PATTERN_BIP48_SEGWIT = "m/48'/coin_type'/account'/2'/change/address_index"
|
||||
PATTERN_BIP49 = "m/49'/coin_type'/account'/change/address_index"
|
||||
# BIP-84 for segwit: https://github.com/bitcoin/bips/blob/master/bip-0084.mediawiki
|
||||
PATTERN_BIP84 = "m/84'/coin_type'/account'/change/address_index"
|
||||
# BIP-86 for taproot: https://github.com/bitcoin/bips/blob/master/bip-0086.mediawiki
|
||||
PATTERN_BIP86 = "m/86'/coin_type'/account'/change/address_index"
|
||||
|
||||
# compatibility patterns, will be removed in the future
|
||||
PATTERN_GREENADDRESS_A = "m/[1,4]/address_index"
|
||||
@ -129,6 +131,9 @@ def validate_path_against_script_type(
|
||||
patterns.append(PATTERN_GREENADDRESS_A)
|
||||
patterns.append(PATTERN_GREENADDRESS_B)
|
||||
|
||||
elif coin.taproot and script_type == InputScriptType.SPENDTAPROOT:
|
||||
patterns.append(PATTERN_BIP86)
|
||||
|
||||
return any(
|
||||
PathSchema.parse(pattern, coin.slip44).match(address_n) for pattern in patterns
|
||||
)
|
||||
@ -179,6 +184,10 @@ def get_schemas_for_coin(coin: coininfo.CoinInfo) -> Iterable[PathSchema]:
|
||||
)
|
||||
)
|
||||
|
||||
# taproot patterns
|
||||
if coin.taproot:
|
||||
patterns.append(PATTERN_BIP86)
|
||||
|
||||
schemas = [PathSchema.parse(pattern, coin.slip44) for pattern in patterns]
|
||||
|
||||
# Some wallets such as Electron-Cash (BCH) store coins on Bitcoin paths.
|
||||
|
Loading…
Reference in New Issue
Block a user