electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 9edffd17542de5773e7284a8c8a2673c766bb3c3
parent ac5cbdaca2a6ed144550dbc97593fdd0058d3d01
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:
Mlib/bitcoin.py | 5++++-
Mlib/commands.py | 2++
2 files changed, 6 insertions(+), 1 deletion(-)

diff --git 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 @@ -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