Browse Source

follow-up fixes to storage-db separation

e1ce3aace7
hard-fail-on-bad-server-string
SomberNight 5 years ago
parent
commit
111ef9ebb1
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 2
      electrum/gui/kivy/uix/dialogs/tx_dialog.py
  2. 2
      electrum/gui/qt/history_list.py
  3. 2
      electrum/gui/qt/main_window.py
  4. 2
      electrum/gui/qt/transaction_dialog.py
  5. 10
      electrum/wallet_db.py

2
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)

2
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()

2
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' +

2
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:

10
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

Loading…
Cancel
Save