electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit cf14d7b3469e75e7910a2d1e86b567bc50a076af
parent 6192bfce463fbd05e3ccdc851aab24a994a7258c
Author: SomberNight <somber.night@protonmail.com>
Date:   Fri,  3 Aug 2018 15:23:39 +0200

wallet: change meaning of is_used

Diffstat:
Melectrum/address_synchronizer.py | 5+----
Melectrum/gui/kivy/uix/dialogs/addresses.py | 8++++----
Melectrum/gui/qt/address_list.py | 6+++---
3 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/electrum/address_synchronizer.py b/electrum/address_synchronizer.py @@ -757,10 +757,7 @@ class AddressSynchronizer(PrintError): def is_used(self, address): h = self.history.get(address,[]) - if len(h) == 0: - return False - c, u, x = self.get_addr_balance(address) - return c + u + x == 0 + return len(h) != 0 def is_empty(self, address): c, u, x = self.get_addr_balance(address) diff --git a/electrum/gui/kivy/uix/dialogs/addresses.py b/electrum/gui/kivy/uix/dialogs/addresses.py @@ -136,14 +136,14 @@ class AddressesDialog(Factory.Popup): for address in _list: label = wallet.labels.get(address, '') balance = sum(wallet.get_addr_balance(address)) - is_used = wallet.is_used(address) - if self.show_used == 1 and (balance or is_used): + is_used_and_empty = wallet.is_used(address) and balance == 0 + if self.show_used == 1 and (balance or is_used_and_empty): continue if self.show_used == 2 and balance == 0: continue - if self.show_used == 3 and not is_used: + if self.show_used == 3 and not is_used_and_empty: 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): continue cards.append(card) diff --git a/electrum/gui/qt/address_list.py b/electrum/gui/qt/address_list.py @@ -95,15 +95,15 @@ class AddressList(MyTreeWidget): self.clear() for address in addr_list: num = len(self.wallet.get_address_history(address)) - is_used = self.wallet.is_used(address) label = self.wallet.labels.get(address, '') c, u, x = self.wallet.get_addr_balance(address) 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 if self.show_used == 2 and balance == 0: continue - if self.show_used == 3 and not is_used: + if self.show_used == 3 and not is_used_and_empty: continue balance_text = self.parent.format_amount(balance, whitespaces=True) fx = self.parent.fx