commit 57c8577d669a49b3b512368e83b1baf0a11ecc6d
parent b029589fc10ba2b210e79b32b4ba5588144c0760
Author: ThomasV <electrumdev@gmail.com>
Date: Sat, 23 May 2015 07:20:22 +0200
Merge pull request #1235 from kyuupichan/storage-write-once
Flush wallet storage once for a sequence of puts.
Diffstat:
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/lib/wallet.py b/lib/wallet.py
@@ -202,10 +202,11 @@ class Abstract_Wallet(object):
tx = {}
for k,v in self.transactions.items():
tx[k] = str(v)
- self.storage.put('transactions', tx)
- self.storage.put('txi', self.txi)
- self.storage.put('txo', self.txo)
- self.storage.put('pruned_txo', self.pruned_txo)
+ # Flush storage only with the last put
+ 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)
def clear_history(self):
with self.transaction_lock:
@@ -1263,8 +1264,8 @@ class Deterministic_Wallet(Abstract_Wallet):
else:
self.use_encryption = False
- self.storage.put('seed', self.seed, True)
- self.storage.put('seed_version', self.seed_version, True)
+ self.storage.put('seed', self.seed, False)
+ self.storage.put('seed_version', self.seed_version, False)
self.storage.put('use_encryption', self.use_encryption,True)
def get_seed(self, password):
@@ -1718,7 +1719,7 @@ class OldWallet(Deterministic_Wallet):
def create_watching_only_wallet(self, mpk):
self.seed_version = OLD_SEED_VERSION
- self.storage.put('seed_version', self.seed_version, True)
+ self.storage.put('seed_version', self.seed_version, False)
self.storage.put('master_public_key', mpk, True)
self.create_account(mpk)