From b04256b474bc76961c6b9e550acb42567af5ed47 Mon Sep 17 00:00:00 2001 From: ThomasV Date: Mon, 14 Jul 2014 02:20:24 +0200 Subject: [PATCH] load_transactions --- lib/wallet.py | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/lib/wallet.py b/lib/wallet.py index 0b552cc9..ff510eb9 100644 --- a/lib/wallet.py +++ b/lib/wallet.py @@ -158,6 +158,24 @@ class Abstract_Wallet(object): self.load_accounts() + self.load_transactions() + + # not saved + self.prevout_values = {} # my own transaction outputs + self.spent_outputs = [] + # spv + self.verifier = None + # 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 = False + self.lock = threading.Lock() + self.transaction_lock = threading.Lock() + self.tx_event = threading.Event() + for tx_hash, tx in self.transactions.items(): + self.update_tx_outputs(tx_hash) + + def load_transactions(self): self.transactions = {} tx_list = self.storage.get('transactions',{}) for k, raw in tx_list.items(): @@ -166,33 +184,13 @@ class Abstract_Wallet(object): except Exception: print_msg("Warning: Cannot deserialize transactions. skipping") continue - self.add_pubkey_addresses(tx) self.transactions[k] = tx - for h,tx in self.transactions.items(): if not self.check_new_tx(h, tx): print_error("removing unreferenced tx", h) self.transactions.pop(h) - # not saved - self.prevout_values = {} # my own transaction outputs - self.spent_outputs = [] - - # spv - self.verifier = None - - # 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 = False - self.lock = threading.Lock() - self.transaction_lock = threading.Lock() - self.tx_event = threading.Event() - for tx_hash, tx in self.transactions.items(): - self.update_tx_outputs(tx_hash) - def add_pubkey_addresses(self, tx): # find the address corresponding to pay-to-pubkey inputs h = tx.hash()