Fix root derivation changes for BIP44_Wallets
Wallet keys use root_name Also typo xub -> xpub
This commit is contained in:
parent
e5aa543707
commit
b120dd8849
|
@ -1727,9 +1727,10 @@ class BIP32_HD_Wallet(BIP32_RD_Wallet):
|
||||||
derivation = self.account_derivation(account_id)
|
derivation = self.account_derivation(account_id)
|
||||||
root_name = self.root_derivation.split('/')[0] # NOT self.root_name!
|
root_name = self.root_derivation.split('/')[0] # NOT self.root_name!
|
||||||
xpub, xprv = self.derive_xkeys(root_name, derivation, password)
|
xpub, xprv = self.derive_xkeys(root_name, derivation, password)
|
||||||
self.add_master_public_key(derivation, xpub)
|
wallet_key = self.root_name + account_id + "'"
|
||||||
|
self.add_master_public_key(wallet_key, xpub)
|
||||||
if xprv:
|
if xprv:
|
||||||
self.add_master_private_key(derivation, xprv, password)
|
self.add_master_private_key(wallet_key, xprv, password)
|
||||||
account = BIP32_Account({'xpub':xpub})
|
account = BIP32_Account({'xpub':xpub})
|
||||||
self.add_account(account_id, account)
|
self.add_account(account_id, account)
|
||||||
if label:
|
if label:
|
||||||
|
@ -1774,6 +1775,8 @@ class BIP44_Wallet(BIP32_HD_Wallet):
|
||||||
digestmodule = hashlib.sha512).read(64)
|
digestmodule = hashlib.sha512).read(64)
|
||||||
|
|
||||||
def derive_xkeys(self, root, derivation, password):
|
def derive_xkeys(self, root, derivation, password):
|
||||||
|
root = self.root_name
|
||||||
|
derivation = derivation.replace(self.root_derivation, root)
|
||||||
x = self.master_private_keys.get(root)
|
x = self.master_private_keys.get(root)
|
||||||
if x:
|
if x:
|
||||||
root_xprv = pw_decode(x, password)
|
root_xprv = pw_decode(x, password)
|
||||||
|
@ -1781,7 +1784,7 @@ class BIP44_Wallet(BIP32_HD_Wallet):
|
||||||
return xpub, xprv
|
return xpub, xprv
|
||||||
else:
|
else:
|
||||||
root_xpub = self.master_public_keys.get(root)
|
root_xpub = self.master_public_keys.get(root)
|
||||||
xpub = bip32_public_derivation(root_xub, root, derivation)
|
xpub = bip32_public_derivation(root_xpub, root, derivation)
|
||||||
return xpub, None
|
return xpub, None
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ class TrezorCompatibleWallet(BIP44_Wallet):
|
||||||
return (account.first_address()[0] if account else None, derivation)
|
return (account.first_address()[0] if account else None, derivation)
|
||||||
|
|
||||||
def derive_xkeys(self, root, derivation, password):
|
def derive_xkeys(self, root, derivation, password):
|
||||||
if self.master_public_keys.get(root):
|
if self.master_public_keys.get(self.root_name):
|
||||||
return BIP44_wallet.derive_xkeys(self, root, derivation, password)
|
return BIP44_wallet.derive_xkeys(self, root, derivation, password)
|
||||||
|
|
||||||
# When creating a wallet we need to ask the device for the
|
# When creating a wallet we need to ask the device for the
|
||||||
|
|
Loading…
Reference in New Issue