From ac69f628fe889e18695852cd3f9033a8f5b38aad Mon Sep 17 00:00:00 2001 From: SomberNight Date: Tue, 30 Jan 2018 00:59:12 +0100 Subject: [PATCH] clean-up wallet.get_address_index --- lib/wallet.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/wallet.py b/lib/wallet.py index 7087e9181..adc285e83 100644 --- a/lib/wallet.py +++ b/lib/wallet.py @@ -340,13 +340,7 @@ class Abstract_Wallet(PrintError): return self.get_address_index(address)[0] def get_address_index(self, address): - if hasattr(self, '_addr_to_addr_index'): - return self._addr_to_addr_index[address] - if address in self.receiving_addresses: - return False, self.receiving_addresses.index(address) - if address in self.change_addresses: - return True, self.change_addresses.index(address) - raise Exception("Address not found", address) + raise NotImplementedError() def export_private_key(self, address, password): """ extended WIF format """ @@ -1714,6 +1708,9 @@ class Deterministic_Wallet(Abstract_Wallet): def is_mine(self, address): return address in self._addr_to_addr_index + def get_address_index(self, address): + return self._addr_to_addr_index[address] + def get_master_public_keys(self): return [self.get_master_public_key()]