mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 07:28:10 +00:00
wallet: do not validate script type in sign message function
This commit is contained in:
parent
d5fb2a477a
commit
f3c401a5c9
@ -26,6 +26,7 @@ async def sign_message(ctx, msg):
|
||||
path=msg.address_n,
|
||||
coin=coin,
|
||||
script_type=msg.script_type,
|
||||
validate_script_type=False,
|
||||
)
|
||||
|
||||
node = await seed.derive_node(ctx, address_n, curve_name=coin.curve_name)
|
||||
|
@ -193,7 +193,7 @@ def address_short(coin: CoinInfo, address: str) -> str:
|
||||
|
||||
|
||||
def validate_full_path(
|
||||
path: list, coin: CoinInfo, script_type: InputScriptType
|
||||
path: list, coin: CoinInfo, script_type: InputScriptType, validate_script_type=True
|
||||
) -> bool:
|
||||
"""
|
||||
Validates derivation path to fit Bitcoin-like coins. We mostly use
|
||||
@ -209,7 +209,9 @@ def validate_full_path(
|
||||
|
||||
if not validate_purpose(path[0], coin):
|
||||
return False
|
||||
if not validate_purpose_against_script_type(path[0], script_type):
|
||||
if validate_script_type and not validate_purpose_against_script_type(
|
||||
path[0], script_type
|
||||
):
|
||||
return False
|
||||
|
||||
if path[1] != coin.slip44 | HARDENED:
|
||||
|
@ -152,6 +152,10 @@ class TestAddress(unittest.TestCase):
|
||||
for path, input_type in correct_derivation_paths:
|
||||
self.assertTrue(validate_full_path(path, coin, input_type))
|
||||
|
||||
self.assertTrue(validate_full_path([44 | HARDENED, 0 | HARDENED, 0 | HARDENED, 0, 0], coin, InputScriptType.SPENDADDRESS))
|
||||
self.assertFalse(validate_full_path([44 | HARDENED, 0 | HARDENED, 0 | HARDENED, 0, 0], coin, InputScriptType.SPENDWITNESS))
|
||||
self.assertTrue(validate_full_path([44 | HARDENED, 0 | HARDENED, 0 | HARDENED, 0, 0], coin, InputScriptType.SPENDWITNESS, validate_script_type=False))
|
||||
|
||||
def test_paths_bch(self):
|
||||
incorrect_derivation_paths = [
|
||||
([44 | HARDENED], InputScriptType.SPENDADDRESS), # invalid length
|
||||
|
Loading…
Reference in New Issue
Block a user