Browse Source

move is_up_to_date method

283
ThomasV 12 years ago
parent
commit
486ebf93e2
  1. 2
      lib/gui_lite.py
  2. 5
      lib/interface.py
  3. 9
      lib/wallet.py

2
lib/gui_lite.py

@ -790,7 +790,7 @@ class MiniDriver(QObject):
self.connecting() self.connecting()
elif not self.wallet.blocks == -1: elif not self.wallet.blocks == -1:
self.connecting() self.connecting()
elif not self.wallet.is_up_to_date: elif not self.wallet.up_to_date:
self.synchronizing() self.synchronizing()
else: else:
self.ready() self.ready()

5
lib/interface.py

@ -367,6 +367,9 @@ class Interface(TcpStratumInterface, HttpStratumInterface):
self.is_connected = False # this exits the polling loop self.is_connected = False # this exits the polling loop
self.poke() self.poke()
def is_up_to_date(self):
return self.responses.empty() and not self.unanswered_requests
@ -470,7 +473,7 @@ class WalletSynchronizer(threading.Thread):
if new_addresses: if new_addresses:
self.interface.subscribe(new_addresses) self.interface.subscribe(new_addresses)
if self.wallet.is_up_to_date(): if self.interface.is_up_to_date():
if not self.wallet.up_to_date: if not self.wallet.up_to_date:
self.wallet.up_to_date = True self.wallet.up_to_date = True
self.wallet.was_updated = True self.wallet.was_updated = True

9
lib/wallet.py

@ -293,9 +293,9 @@ class Wallet:
self.blocks = -1 self.blocks = -1
self.banner = '' self.banner = ''
# there is a difference between self.up_to_date and self.is_up_to_date() # there is a difference between wallet.up_to_date and interface.is_up_to_date()
# self.is_up_to_date() returns true when all requests have been answered and processed # interface.is_up_to_date() returns true when all requests have been answered and processed
# self.up_to_date is true when the wallet is synchronized (stronger requirement) # wallet.up_to_date is true when the wallet is synchronized (stronger requirement)
self.up_to_date_event = threading.Event() self.up_to_date_event = threading.Event()
self.up_to_date_event.clear() self.up_to_date_event.clear()
self.up_to_date = False self.up_to_date = False
@ -316,9 +316,6 @@ class Wallet:
callbacks = self.update_callbacks[:] callbacks = self.update_callbacks[:]
[update() for update in callbacks] [update() for update in callbacks]
def is_up_to_date(self):
return self.interface.responses.empty() and not self.interface.unanswered_requests
def import_key(self, keypair, password): def import_key(self, keypair, password):
address, key = keypair.split(':') address, key = keypair.split(':')

Loading…
Cancel
Save