From 8b2c586d3077c98b29cbdf462876336a706aa943 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Fri, 1 Mar 2019 14:14:30 +0100 Subject: [PATCH] post-storage_db-merge fixups --- electrum/commands.py | 4 ++-- electrum/gui/kivy/uix/screens.py | 2 +- electrum/gui/qt/history_list.py | 8 +++++--- electrum/gui/qt/main_window.py | 2 +- electrum/gui/qt/utxo_list.py | 2 +- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/electrum/commands.py b/electrum/commands.py index 990e7ba2e..19ea8b44c 100644 --- a/electrum/commands.py +++ b/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): diff --git a/electrum/gui/kivy/uix/screens.py b/electrum/gui/kivy/uix/screens.py index 4d1e11ab3..85729a880 100644 --- a/electrum/gui/kivy/uix/screens.py +++ b/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) diff --git a/electrum/gui/qt/history_list.py b/electrum/gui/qt/history_list.py index 58d7bbf07..afc256b91 100644 --- a/electrum/gui/qt/history_list.py +++ b/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() diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py index ba9572de7..35cd6a34d 100644 --- a/electrum/gui/qt/main_window.py +++ b/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' + diff --git a/electrum/gui/qt/utxo_list.py b/electrum/gui/qt/utxo_list.py index 6e8fbf974..d459bea24 100644 --- a/electrum/gui/qt/utxo_list.py +++ b/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))