electrum

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

commit 63963323be8052fc19e51ce15e50ea9bcc1a955f
parent 73e656522e06be1989b95855f79aefec1cb0e006
Author: ThomasV <thomasv@electrum.org>
Date:   Mon,  3 Feb 2020 17:08:34 +0100

storage: take the DB lock when writing to disk.

Diffstat:
Melectrum/json_db.py | 3---
Melectrum/storage.py | 4+---
2 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/electrum/json_db.py b/electrum/json_db.py @@ -61,9 +61,6 @@ class JsonDB(Logger): return True return False - def commit(self): - pass - @locked def dump(self): return json.dumps(self.data, indent=4, sort_keys=True, cls=JsonDBJsonEncoder) diff --git a/electrum/storage.py b/electrum/storage.py @@ -57,7 +57,6 @@ class WalletStorage(Logger): def __init__(self, path, *, manual_upgrades: bool = False): Logger.__init__(self) - self.lock = threading.RLock() self.path = standardize_path(path) self._file_exists = bool(self.path and os.path.exists(self.path)) self._manual_upgrades = manual_upgrades @@ -112,7 +111,7 @@ class WalletStorage(Logger): @profiler def write(self): - with self.lock: + with self.db.lock: self._write() def _write(self): @@ -121,7 +120,6 @@ class WalletStorage(Logger): return if not self.db.modified(): return - self.db.commit() s = self.encrypt_before_writing(self.db.dump()) temp_path = "%s.tmp.%s" % (self.path, os.getpid()) with open(temp_path, "w", encoding='utf-8') as f: