1
0

fix #2133: deserialize_xkey

This commit is contained in:
ThomasV
2017-01-23 20:49:26 +01:00
parent f2b208429d
commit 132fca86b2
4 changed files with 24 additions and 36 deletions

View File

@@ -129,7 +129,7 @@ class Plugin(BasePlugin):
self.cosigner_list = []
for key, keystore in wallet.keystores.items():
xpub = keystore.get_master_public_key()
K = bitcoin.deserialize_xkey(xpub)[-1].encode('hex')
K = bitcoin.deserialize_xpub(xpub)[-1].encode('hex')
_hash = bitcoin.Hash(K).encode('hex')
if not keystore.is_watching_only():
self.keys.append((key, _hash, window))
@@ -203,7 +203,7 @@ class Plugin(BasePlugin):
if not xprv:
return
try:
k = bitcoin.deserialize_xkey(xprv)[-1].encode('hex')
k = bitcoin.deserialize_xprv(xprv)[-1].encode('hex')
EC = bitcoin.EC_KEY(k.decode('hex'))
message = EC.decrypt_message(message)
except Exception as e:

View File

@@ -285,7 +285,7 @@ def get_user_id(storage):
return long_id, short_id
def make_xpub(xpub, s):
_, _, _, c, cK = deserialize_xkey(xpub)
_, _, _, c, cK = deserialize_xpub(xpub)
cK2, c2 = bitcoin._CKD_pub(cK, c, s)
xpub2 = ("0488B21E" + "00" + "00000000" + "00000000").decode("hex") + c2 + cK2
return EncodeBase58Check(xpub2)
@@ -294,7 +294,7 @@ def make_xpub(xpub, s):
def make_billing_address(wallet, num):
long_id, short_id = wallet.get_user_id()
xpub = make_xpub(billing_xpub, long_id)
_, _, _, c, cK = deserialize_xkey(xpub)
_, _, _, c, cK = deserialize_xpub(xpub)
cK, c = bitcoin.CKD_pub(cK, c, num)
address = public_key_to_bc_address( cK )
return address
@@ -524,8 +524,7 @@ class TrustedCoinPlugin(BasePlugin):
challenge = r.get('challenge')
message = 'TRUSTEDCOIN CHALLENGE: ' + challenge
def f(xprv):
from electrum.bitcoin import deserialize_xkey, bip32_private_key, regenerate_key, is_compressed
_, _, _, c, k = deserialize_xkey(xprv)
_, _, _, c, k = deserialize_xprv(xprv)
pk = bip32_private_key([0, 0], k, c)
key = regenerate_key(pk)
compressed = is_compressed(pk)