tfix #3189: do not silence exceptions in get_xpub - electrum - Electrum Bitcoin wallet
 (HTM) git clone https://git.parazyd.org/electrum
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) Submodules
       ---
 (DIR) commit 70d23f9e3ba0ae78840ac5cd3375685ece23dd32
 (DIR) parent b3792344404b9f820d39b2491572e8aaf84d53b1
 (HTM) Author: ThomasV <thomasv@electrum.org>
       Date:   Fri,  3 Nov 2017 10:32:16 +0100
       
       fix #3189: do not silence exceptions in get_xpub
       
       Diffstat:
         M lib/base_wizard.py                  |       7 ++++---
         M plugins/digitalbitbox/digitalbitbo… |       4 +++-
         M plugins/ledger/ledger.py            |      52 ++++++++++++++-----------------
       
       3 files changed, 30 insertions(+), 33 deletions(-)
       ---
 (DIR) diff --git a/lib/base_wizard.py b/lib/base_wizard.py
       t@@ -242,9 +242,10 @@ class BaseWizard(object):
            def on_hw_derivation(self, name, device_info, derivation):
                from .keystore import hardware_keystore
                xtype = 'p2wpkh-p2sh' if derivation.startswith("m/49'/") else 'standard'
       -        xpub = self.plugin.get_xpub(device_info.device.id_, derivation, xtype, self)
       -        if xpub is None:
       -            self.show_error('Cannot read xpub from device')
       +        try:
       +            xpub = self.plugin.get_xpub(device_info.device.id_, derivation, xtype, self)
       +        except BaseException as e:
       +            self.show_error(e)
                    return
                d = {
                    'type': 'hardware',
 (DIR) diff --git a/plugins/digitalbitbox/digitalbitbox.py b/plugins/digitalbitbox/digitalbitbox.py
       t@@ -85,10 +85,12 @@ class DigitalBitbox_Client():
        
        
            def get_xpub(self, bip32_path, xtype):
       -        assert xpub == 'standard'
       +        assert xtype == 'standard'
                reply = self._get_xpub(bip32_path)
                if reply:
                    return reply['xpub']
       +        else:
       +            raise BaseException('no reply')
        
        
            def dbb_has_password(self):
 (DIR) diff --git a/plugins/ledger/ledger.py b/plugins/ledger/ledger.py
       t@@ -59,35 +59,29 @@ class Ledger_Client():
                # This only happens once so it's bearable
                #self.get_client() # prompt for the PIN before displaying the dialog if necessary
                #self.handler.show_message("Computing master public key")
       -        try:
       -            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")
       -            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")
       -
       -            splitPath = bip32_path.split('/')
       -            if splitPath[0] == 'm':
       -                splitPath = splitPath[1:]
       -                bip32_path = bip32_path[2:]
       -            fingerprint = 0
       -            if len(splitPath) > 1:
       -                prevPath = "/".join(splitPath[0:len(splitPath) - 1])
       -                nodeData = self.dongleObject.getWalletPublicKey(prevPath)
       -                publicKey = compress_public_key(nodeData['publicKey'])
       -                h = hashlib.new('ripemd160')
       -                h.update(hashlib.sha256(publicKey).digest())
       -                fingerprint = unpack(">I", h.digest()[0:4])[0]
       -            nodeData = self.dongleObject.getWalletPublicKey(bip32_path)
       -            publicKey = compress_public_key(nodeData['publicKey'])
       -            depth = len(splitPath)
       -            lastChild = splitPath[len(splitPath) - 1].split('\'')
       -            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))
       -            return xpub
       -        except Exception as e:
       -            traceback.print_exc(file=sys.stdout)
       -            #print_error(e)
       -            return None
       +        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")
       +        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")
       +        splitPath = bip32_path.split('/')
       +        if splitPath[0] == 'm':
       +            splitPath = splitPath[1:]
       +            bip32_path = bip32_path[2:]
       +        fingerprint = 0
       +        if len(splitPath) > 1:
       +            prevPath = "/".join(splitPath[0:len(splitPath) - 1])
       +            nodeData = self.dongleObject.getWalletPublicKey(prevPath)
       +            publicKey = compress_public_key(nodeData['publicKey'])#
       +            h = hashlib.new('ripemd160')
       +            h.update(hashlib.sha256(publicKey).digest())
       +            fingerprint = unpack(">I", h.digest()[0:4])[0]
       +        nodeData = self.dongleObject.getWalletPublicKey(bip32_path)
       +        publicKey = compress_public_key(nodeData['publicKey'])
       +        depth = len(splitPath)
       +        lastChild = splitPath[len(splitPath) - 1].split('\'')
       +        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))
       +        return xpub
        
            def has_detached_pin_support(self, client):
                try: