fix #3189: do not silence exceptions in get_xpub
This commit is contained in:
parent
b379234440
commit
70d23f9e3b
|
@ -242,9 +242,10 @@ class BaseWizard(object):
|
||||||
def on_hw_derivation(self, name, device_info, derivation):
|
def on_hw_derivation(self, name, device_info, derivation):
|
||||||
from .keystore import hardware_keystore
|
from .keystore import hardware_keystore
|
||||||
xtype = 'p2wpkh-p2sh' if derivation.startswith("m/49'/") else 'standard'
|
xtype = 'p2wpkh-p2sh' if derivation.startswith("m/49'/") else 'standard'
|
||||||
|
try:
|
||||||
xpub = self.plugin.get_xpub(device_info.device.id_, derivation, xtype, self)
|
xpub = self.plugin.get_xpub(device_info.device.id_, derivation, xtype, self)
|
||||||
if xpub is None:
|
except BaseException as e:
|
||||||
self.show_error('Cannot read xpub from device')
|
self.show_error(e)
|
||||||
return
|
return
|
||||||
d = {
|
d = {
|
||||||
'type': 'hardware',
|
'type': 'hardware',
|
||||||
|
|
|
@ -85,10 +85,12 @@ class DigitalBitbox_Client():
|
||||||
|
|
||||||
|
|
||||||
def get_xpub(self, bip32_path, xtype):
|
def get_xpub(self, bip32_path, xtype):
|
||||||
assert xpub == 'standard'
|
assert xtype == 'standard'
|
||||||
reply = self._get_xpub(bip32_path)
|
reply = self._get_xpub(bip32_path)
|
||||||
if reply:
|
if reply:
|
||||||
return reply['xpub']
|
return reply['xpub']
|
||||||
|
else:
|
||||||
|
raise BaseException('no reply')
|
||||||
|
|
||||||
|
|
||||||
def dbb_has_password(self):
|
def dbb_has_password(self):
|
||||||
|
|
|
@ -59,12 +59,10 @@ class Ledger_Client():
|
||||||
# This only happens once so it's bearable
|
# This only happens once so it's bearable
|
||||||
#self.get_client() # prompt for the PIN before displaying the dialog if necessary
|
#self.get_client() # prompt for the PIN before displaying the dialog if necessary
|
||||||
#self.handler.show_message("Computing master public key")
|
#self.handler.show_message("Computing master public key")
|
||||||
try:
|
|
||||||
if xtype in ['p2wpkh', 'p2wsh'] and not self.supports_native_segwit():
|
if xtype in ['p2wpkh', 'p2wsh'] and not self.supports_native_segwit():
|
||||||
raise Exception("Firmware version too old for Segwit support. Please update at https://www.ledgerwallet.com")
|
raise Exception("Firmware version too old for Segwit support. Please update at https://www.ledgerwallet.com")
|
||||||
if xtype in ['p2wpkh-p2sh', 'p2wsh-p2sh'] and not self.supports_segwit():
|
if xtype in ['p2wpkh-p2sh', 'p2wsh-p2sh'] and not self.supports_segwit():
|
||||||
raise Exception("Firmware version too old for Segwit support. Please update at https://www.ledgerwallet.com")
|
raise Exception("Firmware version too old for Segwit support. Please update at https://www.ledgerwallet.com")
|
||||||
|
|
||||||
splitPath = bip32_path.split('/')
|
splitPath = bip32_path.split('/')
|
||||||
if splitPath[0] == 'm':
|
if splitPath[0] == 'm':
|
||||||
splitPath = splitPath[1:]
|
splitPath = splitPath[1:]
|
||||||
|
@ -73,7 +71,7 @@ class Ledger_Client():
|
||||||
if len(splitPath) > 1:
|
if len(splitPath) > 1:
|
||||||
prevPath = "/".join(splitPath[0:len(splitPath) - 1])
|
prevPath = "/".join(splitPath[0:len(splitPath) - 1])
|
||||||
nodeData = self.dongleObject.getWalletPublicKey(prevPath)
|
nodeData = self.dongleObject.getWalletPublicKey(prevPath)
|
||||||
publicKey = compress_public_key(nodeData['publicKey'])
|
publicKey = compress_public_key(nodeData['publicKey'])#
|
||||||
h = hashlib.new('ripemd160')
|
h = hashlib.new('ripemd160')
|
||||||
h.update(hashlib.sha256(publicKey).digest())
|
h.update(hashlib.sha256(publicKey).digest())
|
||||||
fingerprint = unpack(">I", h.digest()[0:4])[0]
|
fingerprint = unpack(">I", h.digest()[0:4])[0]
|
||||||
|
@ -84,10 +82,6 @@ class Ledger_Client():
|
||||||
childnum = int(lastChild[0]) if len(lastChild) == 1 else 0x80000000 | int(lastChild[0])
|
childnum = int(lastChild[0]) if len(lastChild) == 1 else 0x80000000 | int(lastChild[0])
|
||||||
xpub = bitcoin.serialize_xpub(xtype, nodeData['chainCode'], publicKey, depth, self.i4b(fingerprint), self.i4b(childnum))
|
xpub = bitcoin.serialize_xpub(xtype, nodeData['chainCode'], publicKey, depth, self.i4b(fingerprint), self.i4b(childnum))
|
||||||
return xpub
|
return xpub
|
||||||
except Exception as e:
|
|
||||||
traceback.print_exc(file=sys.stdout)
|
|
||||||
#print_error(e)
|
|
||||||
return None
|
|
||||||
|
|
||||||
def has_detached_pin_support(self, client):
|
def has_detached_pin_support(self, client):
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue