URI: 
       tMerge pull request #3335 from SomberNight/cmd_getprivkeys - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 9edffd17542de5773e7284a8c8a2673c766bb3c3
   DIR parent ac5cbdaca2a6ed144550dbc97593fdd0058d3d01
  HTML Author: ThomasV <thomasv@electrum.org>
       Date:   Thu, 23 Nov 2017 10:03:18 +0100
       
       Merge pull request #3335 from SomberNight/cmd_getprivkeys
       
       more robust getprivatekeys() and is_segwit_address()
       Diffstat:
         M lib/bitcoin.py                      |       5 ++++-
         M lib/commands.py                     |       2 ++
       
       2 files changed, 6 insertions(+), 1 deletion(-)
       ---
   DIR diff --git a/lib/bitcoin.py b/lib/bitcoin.py
       t@@ -569,7 +569,10 @@ def address_from_private_key(sec):
            return pubkey_to_address(txin_type, public_key)
        
        def is_segwit_address(addr):
       -    witver, witprog = segwit_addr.decode(NetworkConstants.SEGWIT_HRP, addr)
       +    try:
       +        witver, witprog = segwit_addr.decode(NetworkConstants.SEGWIT_HRP, addr)
       +    except Exception as e:
       +        return False
            return witprog is not None
        
        def is_b58_address(addr):
   DIR diff --git a/lib/commands.py b/lib/commands.py
       t@@ -273,6 +273,8 @@ class Commands:
            @command('wp')
            def getprivatekeys(self, address, password=None):
                """Get private keys of addresses. You may pass a single wallet address, or a list of wallet addresses."""
       +        if isinstance(address, str):
       +            address = address.strip()
                if is_address(address):
                    return self.wallet.export_private_key(address, password)[0]
                domain = address