From 486ebf93e2eb3b9a1fc514696636bb31f73cb10c Mon Sep 17 00:00:00 2001 From: ThomasV Date: Mon, 15 Oct 2012 07:43:00 +0200 Subject: [PATCH] move is_up_to_date method --- lib/gui_lite.py | 2 +- lib/interface.py | 5 ++++- lib/wallet.py | 9 +++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/gui_lite.py b/lib/gui_lite.py index 8d40cdb47..8f1693032 100644 --- a/lib/gui_lite.py +++ b/lib/gui_lite.py @@ -790,7 +790,7 @@ class MiniDriver(QObject): self.connecting() elif not self.wallet.blocks == -1: self.connecting() - elif not self.wallet.is_up_to_date: + elif not self.wallet.up_to_date: self.synchronizing() else: self.ready() diff --git a/lib/interface.py b/lib/interface.py index 2708378b5..129919bcf 100644 --- a/lib/interface.py +++ b/lib/interface.py @@ -367,6 +367,9 @@ class Interface(TcpStratumInterface, HttpStratumInterface): self.is_connected = False # this exits the polling loop 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: 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: self.wallet.up_to_date = True self.wallet.was_updated = True diff --git a/lib/wallet.py b/lib/wallet.py index 27a69983e..2013993ff 100644 --- a/lib/wallet.py +++ b/lib/wallet.py @@ -293,9 +293,9 @@ class Wallet: self.blocks = -1 self.banner = '' - # there is a difference between self.up_to_date and self.is_up_to_date() - # self.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) + # there is a difference between wallet.up_to_date and interface.is_up_to_date() + # interface.is_up_to_date() returns true when all requests have been answered and processed + # 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.clear() self.up_to_date = False @@ -316,9 +316,6 @@ class Wallet: callbacks = self.update_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): address, key = keypair.split(':')