1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-15 12:08:59 +00:00

ProtocolMixin: make expand_path static

This commit is contained in:
Neil Booth 2016-02-10 23:53:14 +09:00
parent f1868b72cd
commit bc14e05998

View File

@ -365,7 +365,8 @@ class ProtocolMixin(object):
# Convert minus signs to uint32 with flag # Convert minus signs to uint32 with flag
return [ int(abs(x) | self.PRIME_DERIVATION_FLAG) if x < 0 else x for x in n ] return [ int(abs(x) | self.PRIME_DERIVATION_FLAG) if x < 0 else x for x in n ]
def expand_path(self, n): @staticmethod
def expand_path(n):
# Convert string of bip32 path to list of uint32 integers with prime flags # Convert string of bip32 path to list of uint32 integers with prime flags
# 0/-1/1' -> [0, 0x80000001, 0x80000001] # 0/-1/1' -> [0, 0x80000001, 0x80000001]
if not n: if not n:
@ -384,7 +385,7 @@ class ProtocolMixin(object):
x = abs(int(x)) x = abs(int(x))
if prime: if prime:
x |= self.PRIME_DERIVATION_FLAG x |= ProtocolMixin.PRIME_DERIVATION_FLAG
path.append(x) path.append(x)