mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-17 19:00:58 +00:00
feat(legacy): Add BIP86 paths to coin_path_check().
This commit is contained in:
parent
2e4884199b
commit
78a9ab8123
@ -655,6 +655,7 @@ bool coin_path_check(const CoinInfo *coin, InputScriptType script_type,
|
|||||||
valid = valid && check_cointype(coin, address_n[1], check_known);
|
valid = valid && check_cointype(coin, address_n[1], check_known);
|
||||||
if (check_script_type) {
|
if (check_script_type) {
|
||||||
valid = valid && has_multisig;
|
valid = valid && has_multisig;
|
||||||
|
// we do not support Multisig with Taproot yet
|
||||||
valid = valid && (script_type == InputScriptType_SPENDMULTISIG ||
|
valid = valid && (script_type == InputScriptType_SPENDMULTISIG ||
|
||||||
script_type == InputScriptType_SPENDP2SHWITNESS ||
|
script_type == InputScriptType_SPENDP2SHWITNESS ||
|
||||||
script_type == InputScriptType_SPENDWITNESS);
|
script_type == InputScriptType_SPENDWITNESS);
|
||||||
@ -722,6 +723,31 @@ bool coin_path_check(const CoinInfo *coin, InputScriptType script_type,
|
|||||||
return valid;
|
return valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// m/86' : BIP86 Taproot
|
||||||
|
// m / purpose' / coin_type' / account' / change / address_index
|
||||||
|
if (address_n_count > 0 && address_n[0] == (0x80000000 + 86)) {
|
||||||
|
valid = valid && coin->has_taproot;
|
||||||
|
valid = valid && (coin->bech32_prefix != NULL);
|
||||||
|
if (check_known) {
|
||||||
|
valid = valid && (address_n_count == 5);
|
||||||
|
} else {
|
||||||
|
valid = valid && (address_n_count >= 2);
|
||||||
|
}
|
||||||
|
valid = valid && check_cointype(coin, address_n[1], check_known);
|
||||||
|
if (check_script_type) {
|
||||||
|
// we do not support Multisig with Taproot yet
|
||||||
|
valid = valid && !has_multisig;
|
||||||
|
valid = valid && (script_type == InputScriptType_SPENDTAPROOT);
|
||||||
|
}
|
||||||
|
if (check_known) {
|
||||||
|
valid = valid && ((address_n[2] & 0x80000000) == 0x80000000);
|
||||||
|
valid = valid && ((address_n[2] & 0x7fffffff) <= PATH_MAX_ACCOUNT);
|
||||||
|
valid = valid && (address_n[3] <= PATH_MAX_CHANGE);
|
||||||
|
valid = valid && (address_n[4] <= PATH_MAX_ADDRESS_INDEX);
|
||||||
|
}
|
||||||
|
return valid;
|
||||||
|
}
|
||||||
|
|
||||||
// Green Address compatibility pattern. Will be removed in the future.
|
// Green Address compatibility pattern. Will be removed in the future.
|
||||||
// m / [1,4] / address_index
|
// m / [1,4] / address_index
|
||||||
if (address_n_count > 0 && (address_n[0] == 1 || address_n[0] == 4)) {
|
if (address_n_count > 0 && (address_n[0] == 1 || address_n[0] == 4)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user