1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-02-15 09:02:02 +00:00

Merge pull request #52 from kyuupichan/master

ProtocolMixin: make expand_path static
This commit is contained in:
Pavol Rusnak 2016-02-10 16:25:27 +01:00
commit c665350a35

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)