diff --git a/lib/bitcoin.py b/lib/bitcoin.py index fce74365..1a4f5bb2 100644 --- a/lib/bitcoin.py +++ b/lib/bitcoin.py @@ -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): diff --git a/lib/commands.py b/lib/commands.py index 6857ea9f..0d8907d7 100644 --- a/lib/commands.py +++ b/lib/commands.py @@ -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