From 29ce50a30566d1c69c99896c355df9084a3b3cbd Mon Sep 17 00:00:00 2001 From: SomberNight Date: Wed, 12 Jun 2019 18:27:13 +0200 Subject: [PATCH] follow-up prev wallet.is_mine needs to tolerate None as input --- electrum/wallet.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/electrum/wallet.py b/electrum/wallet.py index 2ceaac3f9..d1fa0b88c 100644 --- a/electrum/wallet.py +++ b/electrum/wallet.py @@ -347,6 +347,8 @@ class Abstract_Wallet(AddressSynchronizer): def export_private_key(self, address, password): if self.is_watching_only(): raise Exception(_("This is a watching-only wallet")) + if not is_address(address): + raise Exception(f"Invalid bitcoin address: {address}") if not self.is_mine(address): raise Exception(_('Address not in wallet.') + f' {address}') index = self.get_address_index(address) @@ -1488,8 +1490,6 @@ class Imported_Wallet(Simple_Wallet): def get_address_index(self, address): # returns None if address is not mine - if not is_address(address): - raise Exception(f"Invalid bitcoin address: {address}") return self.get_public_key(address) def get_public_key(self, address): @@ -1681,8 +1681,6 @@ class Deterministic_Wallet(Abstract_Wallet): return True def get_address_index(self, address): - if not is_address(address): - raise Exception(f"Invalid bitcoin address: {address}") return self.db.get_address_index(address) def get_master_public_keys(self):