tAttempt at fixing issue 1525 - electrum - Electrum Bitcoin wallet
 (HTM) git clone https://git.parazyd.org/electrum
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) Submodules
       ---
 (DIR) commit d6126841966e6ed3f6ffc9ba5ab24b1c520db77b
 (DIR) parent 55fafc35c11298cd0469271358c65262cf2935ee
 (HTM) Author: Neil Booth <kyuupichan@gmail.com>
       Date:   Wed, 11 Nov 2015 16:38:28 +0900
       
       Attempt at fixing issue 1525
       
       The main problem is, I think, that the synchronizer and wallet
       still exist in the daemon process, and updates to things like
       TXI and TXO are made but never saved (as client exit is what
       saves the wallet).
       
       I suspect fixing the lingering objects is hard; this is a short
       tterm fix to ensure that when internal wallet state is updated,
       tthe wallet is written to disk, so later daemon clients pick up
       tthe correct state.
       
       Diffstat:
         M lib/wallet.py                       |      11 +++++++----
       
       1 file changed, 7 insertions(+), 4 deletions(-)
       ---
 (DIR) diff --git a/lib/wallet.py b/lib/wallet.py
       t@@ -224,7 +224,8 @@ class Abstract_Wallet(PrintError):
                    self.storage.put('transactions', tx, False)
                    self.storage.put('txi', self.txi, False)
                    self.storage.put('txo', self.txo, False)
       -            self.storage.put('pruned_txo', self.pruned_txo, True)
       +            self.storage.put('pruned_txo', self.pruned_txo, False)
       +            self.storage.put('addr_history', self.history, True)
        
            def clear_history(self):
                with self.transaction_lock:
       t@@ -235,7 +236,6 @@ class Abstract_Wallet(PrintError):
                with self.lock:
                    self.history = {}
                    self.tx_addr_hist = {}
       -        self.storage.put('addr_history', self.history, True)
        
            @profiler
            def build_reverse_history(self):
       t@@ -262,8 +262,9 @@ class Abstract_Wallet(PrintError):
                        if tx is not None:
                            tx.deserialize()
                            self.add_transaction(tx_hash, tx)
       +                    save = True
                if save:
       -            self.storage.put('addr_history', self.history, True)
       +            self.save_transactions()
        
            # wizard action
            def get_action(self):
       t@@ -789,6 +790,7 @@ class Abstract_Wallet(PrintError):
        
            def receive_tx_callback(self, tx_hash, tx, tx_height):
                self.add_transaction(tx_hash, tx)
       +        self.save_transactions()
                self.add_unverified_tx(tx_hash, tx_height)
        
        
       t@@ -803,7 +805,6 @@ class Abstract_Wallet(PrintError):
                                self.remove_transaction(tx_hash)
        
                    self.history[addr] = hist
       -            self.storage.put('addr_history', self.history, True)
        
                for tx_hash, tx_height in hist:
                    # add it in case it was previously unconfirmed
       t@@ -818,6 +819,8 @@ class Abstract_Wallet(PrintError):
                        tx.deserialize()
                        self.add_transaction(tx_hash, tx)
        
       +        # Write updated TXI, TXO etc.
       +        self.save_transactions()
        
            def get_history(self, domain=None):
                from collections import defaultdict