Browse Source

Merge pull request #3335 from SomberNight/cmd_getprivkeys

more robust getprivatekeys() and is_segwit_address()
3.0.x
ThomasV 7 years ago
committed by GitHub
parent
commit
9edffd1754
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      lib/bitcoin.py
  2. 2
      lib/commands.py

5
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):

2
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

Loading…
Cancel
Save