electrum

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

commit b04256b474bc76961c6b9e550acb42567af5ed47
parent 3c7346ee9c4cee3174fd5db03f97cd28fe1eb961
Author: ThomasV <thomasv@gitorious>
Date:   Mon, 14 Jul 2014 02:20:24 +0200

load_transactions

Diffstat:
Mlib/wallet.py | 36+++++++++++++++++-------------------
1 file changed, 17 insertions(+), 19 deletions(-)

diff --git a/lib/wallet.py b/lib/wallet.py @@ -158,34 +158,16 @@ class Abstract_Wallet(object): self.load_accounts() - self.transactions = {} - tx_list = self.storage.get('transactions',{}) - for k, raw in tx_list.items(): - try: - tx = Transaction.deserialize(raw) - 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) + 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() @@ -193,6 +175,22 @@ class Abstract_Wallet(object): 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(): + try: + tx = Transaction.deserialize(raw) + 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) + def add_pubkey_addresses(self, tx): # find the address corresponding to pay-to-pubkey inputs h = tx.hash()