commit 111ef9ebb11380cf2ee49b327988a8e21e99934b
parent 5d8d8f743a6c8c4539235c2b5504720bb1b0c01b
Author: SomberNight <somber.night@protonmail.com>
Date: Thu, 13 Feb 2020 20:00:12 +0100
follow-up fixes to storage-db separation
e1ce3aace7e3143da24115890d9bae78a9f5bcaf
Diffstat:
5 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/electrum/gui/kivy/uix/dialogs/tx_dialog.py b/electrum/gui/kivy/uix/dialogs/tx_dialog.py
@@ -294,7 +294,7 @@ class TxDialog(Factory.Popup):
if b:
for tx in to_delete:
self.wallet.remove_transaction(tx)
- self.wallet.storage.write()
+ self.wallet.save_db()
self.app._trigger_update_wallet() # FIXME private...
self.dismiss()
d = Question(question, on_prompt)
diff --git a/electrum/gui/qt/history_list.py b/electrum/gui/qt/history_list.py
@@ -666,7 +666,7 @@ class HistoryList(MyTreeView, AcceptFileDragDrop):
return
for tx in to_delete:
self.wallet.remove_transaction(tx)
- self.wallet.storage.write()
+ self.wallet.save_db()
# need to update at least: history_list, utxo_list, address_list
self.parent.need_update.set()
diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py
@@ -3006,7 +3006,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
win.show_error(e)
return False
else:
- self.wallet.storage.write()
+ self.wallet.save_db()
# need to update at least: history_list, utxo_list, address_list
self.need_update.set()
msg = (_("Transaction added to wallet history.") + '\n\n' +
diff --git a/electrum/gui/qt/transaction_dialog.py b/electrum/gui/qt/transaction_dialog.py
@@ -308,7 +308,7 @@ class BaseTxDialog(QDialog, MessageBoxMixin):
name = 'signed_%s.txn' % (tx.txid()[0:8])
else:
name = self.wallet.basename() + time.strftime('-%Y%m%d-%H%M.psbt')
- fileName = self.main_window.getSaveFileName(_("Select where to save your signed transaction"),
+ fileName = self.main_window.getSaveFileName(_("Select where to save your transaction"),
name,
TRANSACTION_FILE_EXTENSION_FILTER)
if not fileName:
diff --git a/electrum/wallet_db.py b/electrum/wallet_db.py
@@ -28,7 +28,7 @@ import json
import copy
import threading
from collections import defaultdict
-from typing import Dict, Optional, List, Tuple, Set, Iterable, NamedTuple, Sequence
+from typing import Dict, Optional, List, Tuple, Set, Iterable, NamedTuple, Sequence, TYPE_CHECKING
import binascii
from . import util, bitcoin
@@ -41,6 +41,10 @@ from .lnutil import ChannelConstraints, Outpoint, ShachainElement
from .json_db import StoredDict, JsonDB, locked, modifier
from .plugin import run_hook, plugin_loaders
+if TYPE_CHECKING:
+ from .storage import WalletStorage
+
+
# seed_version is now used for the version of the wallet file
OLD_SEED_VERSION = 4 # electrum versions < 2.0
@@ -998,11 +1002,11 @@ class WalletDB(JsonDB):
v = binascii.unhexlify(v) if v is not None else None
return v
- def write(self, storage):
+ def write(self, storage: 'WalletStorage'):
with self.lock:
self._write(storage)
- def _write(self, storage):
+ def _write(self, storage: 'WalletStorage'):
if threading.currentThread().isDaemon():
self.logger.warning('daemon thread cannot write db')
return