wallet: change meaning of is_used

This commit is contained in:
SomberNight 2018-08-03 15:23:39 +02:00
parent 6192bfce46
commit cf14d7b346
No known key found for this signature in database
GPG key ID: B33B5F232C6271E9
3 changed files with 8 additions and 11 deletions

View file

@ -757,10 +757,7 @@ class AddressSynchronizer(PrintError):
def is_used(self, address): def is_used(self, address):
h = self.history.get(address,[]) h = self.history.get(address,[])
if len(h) == 0: return len(h) != 0
return False
c, u, x = self.get_addr_balance(address)
return c + u + x == 0
def is_empty(self, address): def is_empty(self, address):
c, u, x = self.get_addr_balance(address) c, u, x = self.get_addr_balance(address)

View file

@ -136,14 +136,14 @@ class AddressesDialog(Factory.Popup):
for address in _list: for address in _list:
label = wallet.labels.get(address, '') label = wallet.labels.get(address, '')
balance = sum(wallet.get_addr_balance(address)) balance = sum(wallet.get_addr_balance(address))
is_used = wallet.is_used(address) is_used_and_empty = wallet.is_used(address) and balance == 0
if self.show_used == 1 and (balance or is_used): if self.show_used == 1 and (balance or is_used_and_empty):
continue continue
if self.show_used == 2 and balance == 0: if self.show_used == 2 and balance == 0:
continue continue
if self.show_used == 3 and not is_used: if self.show_used == 3 and not is_used_and_empty:
continue continue
card = self.get_card(address, balance, is_used, label) card = self.get_card(address, balance, is_used_and_empty, label)
if search and not self.ext_search(card, search): if search and not self.ext_search(card, search):
continue continue
cards.append(card) cards.append(card)

View file

@ -95,15 +95,15 @@ class AddressList(MyTreeWidget):
self.clear() self.clear()
for address in addr_list: for address in addr_list:
num = len(self.wallet.get_address_history(address)) num = len(self.wallet.get_address_history(address))
is_used = self.wallet.is_used(address)
label = self.wallet.labels.get(address, '') label = self.wallet.labels.get(address, '')
c, u, x = self.wallet.get_addr_balance(address) c, u, x = self.wallet.get_addr_balance(address)
balance = c + u + x balance = c + u + x
if self.show_used == 1 and (balance or is_used): is_used_and_empty = self.wallet.is_used(address) and balance == 0
if self.show_used == 1 and (balance or is_used_and_empty):
continue continue
if self.show_used == 2 and balance == 0: if self.show_used == 2 and balance == 0:
continue continue
if self.show_used == 3 and not is_used: if self.show_used == 3 and not is_used_and_empty:
continue continue
balance_text = self.parent.format_amount(balance, whitespaces=True) balance_text = self.parent.format_amount(balance, whitespaces=True)
fx = self.parent.fx fx = self.parent.fx