From 2dd1ae64914bb259bd9b92493099ff81c90c421b Mon Sep 17 00:00:00 2001 From: Adrian Nagy Date: Thu, 18 Apr 2019 14:25:42 +0200 Subject: [PATCH] refactor path validation --- core/src/apps/tezos/helpers.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/core/src/apps/tezos/helpers.py b/core/src/apps/tezos/helpers.py index 4640d7eb3..6cf5e331b 100644 --- a/core/src/apps/tezos/helpers.py +++ b/core/src/apps/tezos/helpers.py @@ -54,10 +54,14 @@ def validate_full_path(path: list) -> bool: return False if path[1] != 1729 | HARDENED: return False - if length == 3 and (path[2] < HARDENED or path[2] > 1000000 | HARDENED): - return False - if length == 4 and (path[2] != 0 | HARDENED or path[3] < HARDENED or path[3] > 1000000 | HARDENED): - return False + if length == 3: + if path[2] < HARDENED or path[2] > 1000000 | HARDENED: + return False + if length == 4: + if path[2] != 0 | HARDENED: + return False + if path[3] < HARDENED or path[3] > 1000000 | HARDENED: + return False return True