Browse Source

post-storage_db-merge fixups

sqlite_db
SomberNight 6 years ago
parent
commit
8b2c586d30
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 4
      electrum/commands.py
  2. 2
      electrum/gui/kivy/uix/screens.py
  3. 8
      electrum/gui/qt/history_list.py
  4. 2
      electrum/gui/qt/main_window.py
  5. 2
      electrum/gui/qt/utxo_list.py

4
electrum/commands.py

@ -665,7 +665,7 @@ class Commands:
tx = Transaction(tx)
if not self.wallet.add_transaction(tx.txid(), tx):
return False
self.wallet.save_transactions()
self.wallet.storage.write()
return tx.txid()
@command('wp')
@ -735,7 +735,7 @@ class Commands:
to_delete |= self.wallet.get_depending_transactions(txid)
for tx_hash in to_delete:
self.wallet.remove_transaction(tx_hash)
self.wallet.save_transactions(write=True)
self.wallet.storage.write()
@command('')
def help(self):

2
electrum/gui/kivy/uix/screens.py

@ -118,7 +118,7 @@ class HistoryScreen(CScreen):
def show_tx(self, obj):
tx_hash = obj.tx_hash
tx = self.app.wallet.transactions.get(tx_hash)
tx = self.app.wallet.db.get_transaction(tx_hash)
if not tx:
return
self.app.tx_dialog(tx)

8
electrum/gui/qt/history_list.py

@ -547,7 +547,7 @@ class HistoryList(MyTreeView, AcceptFileDragDrop):
self.show_transaction(tx_item['txid'])
def show_transaction(self, tx_hash):
tx = self.wallet.transactions.get(tx_hash)
tx = self.wallet.db.get_transaction(tx_hash)
if not tx:
return
label = self.wallet.get_label(tx_hash) or None # prefer 'None' if not defined (force tx dialog to hide Description field if missing)
@ -568,7 +568,9 @@ class HistoryList(MyTreeView, AcceptFileDragDrop):
column_title = self.hm.headerData(column, Qt.Horizontal, Qt.DisplayRole)
column_data = self.hm.data(idx, Qt.DisplayRole).value()
tx_hash = tx_item['txid']
tx = self.wallet.transactions[tx_hash]
tx = self.wallet.db.get_transaction(tx_hash)
if not tx:
return
tx_URL = block_explorer_URL(self.config, 'tx', tx_hash)
height = self.wallet.get_tx_height(tx_hash).height
is_relevant, is_mine, v, fee = self.wallet.get_wallet_delta(tx)
@ -613,7 +615,7 @@ class HistoryList(MyTreeView, AcceptFileDragDrop):
return
for tx in to_delete:
self.wallet.remove_transaction(tx)
self.wallet.save_transactions(write=True)
self.wallet.storage.write()
# need to update at least: history_list, utxo_list, address_list
self.parent.need_update.set()

2
electrum/gui/qt/main_window.py

@ -3363,7 +3363,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
win.show_error(e)
return False
else:
self.wallet.save_transactions(write=True)
self.wallet.storage.write()
# 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/utxo_list.py

@ -107,7 +107,7 @@ class UTXOList(MyTreeView):
menu.addAction(_("Spend"), lambda: self.parent.spend_coins(coins))
if len(selected) == 1:
txid = selected[0].split(':')[0]
tx = self.wallet.transactions.get(txid)
tx = self.wallet.db.get_transaction(txid)
if tx:
label = self.wallet.get_label(txid) or None # Prefer None if empty (None hides the Description: field in the window)
menu.addAction(_("Details"), lambda: self.parent.show_transaction(tx, label))

Loading…
Cancel
Save