Merge pull request #1235 from kyuupichan/storage-write-once
Flush wallet storage once for a sequence of puts.
This commit is contained in:
commit
57c8577d66
|
@ -202,10 +202,11 @@ class Abstract_Wallet(object):
|
||||||
tx = {}
|
tx = {}
|
||||||
for k,v in self.transactions.items():
|
for k,v in self.transactions.items():
|
||||||
tx[k] = str(v)
|
tx[k] = str(v)
|
||||||
self.storage.put('transactions', tx)
|
# Flush storage only with the last put
|
||||||
self.storage.put('txi', self.txi)
|
self.storage.put('transactions', tx, False)
|
||||||
self.storage.put('txo', self.txo)
|
self.storage.put('txi', self.txi, False)
|
||||||
self.storage.put('pruned_txo', self.pruned_txo)
|
self.storage.put('txo', self.txo, False)
|
||||||
|
self.storage.put('pruned_txo', self.pruned_txo, True)
|
||||||
|
|
||||||
def clear_history(self):
|
def clear_history(self):
|
||||||
with self.transaction_lock:
|
with self.transaction_lock:
|
||||||
|
@ -1263,8 +1264,8 @@ class Deterministic_Wallet(Abstract_Wallet):
|
||||||
else:
|
else:
|
||||||
self.use_encryption = False
|
self.use_encryption = False
|
||||||
|
|
||||||
self.storage.put('seed', self.seed, True)
|
self.storage.put('seed', self.seed, False)
|
||||||
self.storage.put('seed_version', self.seed_version, True)
|
self.storage.put('seed_version', self.seed_version, False)
|
||||||
self.storage.put('use_encryption', self.use_encryption,True)
|
self.storage.put('use_encryption', self.use_encryption,True)
|
||||||
|
|
||||||
def get_seed(self, password):
|
def get_seed(self, password):
|
||||||
|
@ -1718,7 +1719,7 @@ class OldWallet(Deterministic_Wallet):
|
||||||
|
|
||||||
def create_watching_only_wallet(self, mpk):
|
def create_watching_only_wallet(self, mpk):
|
||||||
self.seed_version = OLD_SEED_VERSION
|
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.storage.put('master_public_key', mpk, True)
|
||||||
self.create_account(mpk)
|
self.create_account(mpk)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue