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

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

@ -118,7 +118,7 @@ class HistoryScreen(CScreen):
def show_tx(self, obj): def show_tx(self, obj):
tx_hash = obj.tx_hash 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: if not tx:
return return
self.app.tx_dialog(tx) 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']) self.show_transaction(tx_item['txid'])
def show_transaction(self, tx_hash): def show_transaction(self, tx_hash):
tx = self.wallet.transactions.get(tx_hash) tx = self.wallet.db.get_transaction(tx_hash)
if not tx: if not tx:
return return
label = self.wallet.get_label(tx_hash) or None # prefer 'None' if not defined (force tx dialog to hide Description field if missing) 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_title = self.hm.headerData(column, Qt.Horizontal, Qt.DisplayRole)
column_data = self.hm.data(idx, Qt.DisplayRole).value() column_data = self.hm.data(idx, Qt.DisplayRole).value()
tx_hash = tx_item['txid'] 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) tx_URL = block_explorer_URL(self.config, 'tx', tx_hash)
height = self.wallet.get_tx_height(tx_hash).height height = self.wallet.get_tx_height(tx_hash).height
is_relevant, is_mine, v, fee = self.wallet.get_wallet_delta(tx) is_relevant, is_mine, v, fee = self.wallet.get_wallet_delta(tx)
@ -613,7 +615,7 @@ class HistoryList(MyTreeView, AcceptFileDragDrop):
return return
for tx in to_delete: for tx in to_delete:
self.wallet.remove_transaction(tx) 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 # need to update at least: history_list, utxo_list, address_list
self.parent.need_update.set() 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) win.show_error(e)
return False return False
else: else:
self.wallet.save_transactions(write=True) self.wallet.storage.write()
# need to update at least: history_list, utxo_list, address_list # need to update at least: history_list, utxo_list, address_list
self.need_update.set() self.need_update.set()
msg = (_("Transaction added to wallet history.") + '\n\n' + 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)) menu.addAction(_("Spend"), lambda: self.parent.spend_coins(coins))
if len(selected) == 1: if len(selected) == 1:
txid = selected[0].split(':')[0] txid = selected[0].split(':')[0]
tx = self.wallet.transactions.get(txid) tx = self.wallet.db.get_transaction(txid)
if tx: if tx:
label = self.wallet.get_label(txid) or None # Prefer None if empty (None hides the Description: field in the window) 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)) menu.addAction(_("Details"), lambda: self.parent.show_transaction(tx, label))

Loading…
Cancel
Save