|
|
@ -164,7 +164,6 @@ class ImportedAccount(Account): |
|
|
|
def get_name(self, k): |
|
|
|
return _('Imported keys') |
|
|
|
|
|
|
|
|
|
|
|
def update_password(self, old_password, new_password): |
|
|
|
for k, v in self.keypairs.items(): |
|
|
|
pubkey, a = v |
|
|
@ -280,6 +279,8 @@ class BIP32_Account(Account): |
|
|
|
def __init__(self, v): |
|
|
|
Account.__init__(self, v) |
|
|
|
self.xpub = v['xpub'] |
|
|
|
self.xpub_receive = None |
|
|
|
self.xpub_change = None |
|
|
|
|
|
|
|
def dump(self): |
|
|
|
d = Account.dump(self) |
|
|
@ -308,7 +309,17 @@ class BIP32_Account(Account): |
|
|
|
return pubkeys[i] |
|
|
|
|
|
|
|
def derive_pubkeys(self, for_change, n): |
|
|
|
return self.derive_pubkey_from_xpub(self.xpub, for_change, n) |
|
|
|
xpub = self.xpub_change if for_change else self.xpub_receive |
|
|
|
if xpub is None: |
|
|
|
xpub = bip32_public_derivation(self.xpub, "", "/%d"%for_change) |
|
|
|
if for_change: |
|
|
|
self.xpub_change = xpub |
|
|
|
else: |
|
|
|
self.xpub_receive = xpub |
|
|
|
_, _, _, c, cK = deserialize_xkey(xpub) |
|
|
|
cK, c = CKD_pub(cK, c, n) |
|
|
|
result = cK.encode('hex') |
|
|
|
return result |
|
|
|
|
|
|
|
|
|
|
|
def get_private_key(self, sequence, wallet, password): |
|
|
@ -348,18 +359,9 @@ class BIP32_Account(Account): |
|
|
|
assert len(s) == 2 |
|
|
|
return xkey, s |
|
|
|
|
|
|
|
|
|
|
|
def get_name(self, k): |
|
|
|
name = "Unnamed account" |
|
|
|
m = re.match("m/(\d+)'", k) |
|
|
|
if m: |
|
|
|
num = m.group(1) |
|
|
|
if num == '0': |
|
|
|
name = "Main account" |
|
|
|
else: |
|
|
|
name = "Account %s"%num |
|
|
|
|
|
|
|
return name |
|
|
|
return "Main account" if k == '0' else "Account " + k |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|