wallet: remove method get_num_tx

This commit is contained in:
SomberNight 2018-08-14 21:54:11 +02:00
parent f7166e95c4
commit 3089edd3a2
No known key found for this signature in database
GPG key ID: B33B5F232C6271E9
2 changed files with 2 additions and 5 deletions

View file

@ -102,6 +102,7 @@ class AddressSynchronizer(PrintError):
return h return h
def get_address_history_len(self, addr: str) -> int: def get_address_history_len(self, addr: str) -> int:
"""Return number of transactions where address is involved."""
return len(self._history_local.get(addr, ())) return len(self._history_local.get(addr, ()))
def get_txin_address(self, txi): def get_txin_address(self, txi):
@ -617,10 +618,6 @@ class AddressSynchronizer(PrintError):
def is_up_to_date(self): def is_up_to_date(self):
with self.lock: return self.up_to_date with self.lock: return self.up_to_date
def get_num_tx(self, address):
""" return number of transactions where address is involved """
return len(self.history.get(address, []))
def get_tx_delta(self, tx_hash, address): def get_tx_delta(self, tx_hash, address):
"effect of tx on address" "effect of tx on address"
delta = 0 delta = 0

View file

@ -563,7 +563,7 @@ class Abstract_Wallet(AddressSynchronizer):
# confirmations. Select the unused addresses within the # confirmations. Select the unused addresses within the
# gap limit; if none take one at random # gap limit; if none take one at random
change_addrs = [addr for addr in addrs if change_addrs = [addr for addr in addrs if
self.get_num_tx(addr) == 0] self.get_address_history_len(addr) == 0]
if not change_addrs: if not change_addrs:
change_addrs = [random.choice(addrs)] change_addrs = [random.choice(addrs)]
else: else: