|
@ -112,15 +112,14 @@ class WalletStorage(PrintError): |
|
|
elif key in self.data: |
|
|
elif key in self.data: |
|
|
self.modified = True |
|
|
self.modified = True |
|
|
self.data.pop(key) |
|
|
self.data.pop(key) |
|
|
if save: |
|
|
if save: |
|
|
self.write() |
|
|
self.write() |
|
|
|
|
|
|
|
|
def write(self): |
|
|
def write(self): |
|
|
assert not threading.currentThread().isDaemon() |
|
|
assert not threading.currentThread().isDaemon() |
|
|
if not self.modified: |
|
|
if not self.modified: |
|
|
return |
|
|
return |
|
|
with self.lock: |
|
|
s = json.dumps(self.data, indent=4, sort_keys=True) |
|
|
s = json.dumps(self.data, indent=4, sort_keys=True) |
|
|
|
|
|
temp_path = "%s.tmp.%s" % (self.path, os.getpid()) |
|
|
temp_path = "%s.tmp.%s" % (self.path, os.getpid()) |
|
|
with open(temp_path, "w") as f: |
|
|
with open(temp_path, "w") as f: |
|
|
f.write(s) |
|
|
f.write(s) |
|
|