electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 449feddaaf2ff84ac2bc046a2bf2efcec7c492ee
parent 65a155401bf329aca6dcf5615eb74a132092de62
Author: ThomasV <thomasv@gitorious>
Date:   Wed,  3 Sep 2014 10:45:41 +0200

raise an exception on trezor decrypt

Diffstat:
Mgui/qt/main_window.py | 12+++++++-----
Mplugins/trezor.py | 21+++++++++++----------
2 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py @@ -2000,9 +2000,9 @@ class ElectrumWindow(QMainWindow): try: decrypted = self.wallet.decrypt_message(str(pubkey_e.text()), str(encrypted_e.toPlainText()), password) message_e.setText(decrypted) - except Exception as e: + except BaseException as e: traceback.print_exc(file=sys.stdout) - self.show_message(str(e)) + self.show_warning(str(e)) def do_encrypt(self, message_e, pubkey_e, encrypted_e): @@ -2011,10 +2011,9 @@ class ElectrumWindow(QMainWindow): try: encrypted = bitcoin.encrypt_message(message, str(pubkey_e.text())) encrypted_e.setText(encrypted) - except Exception as e: + except BaseException as e: traceback.print_exc(file=sys.stdout) - self.show_message(str(e)) - + self.show_warning(str(e)) def encrypt_message(self, address = ''): @@ -2065,6 +2064,9 @@ class ElectrumWindow(QMainWindow): def show_message(self, msg): QMessageBox.information(self, _('Message'), msg, _('OK')) + def show_warning(self, msg): + QMessageBox.warning(self, _('Warning'), msg, _('OK')) + def password_dialog(self, msg=None): d = QDialog(self) d.setModal(1) diff --git a/plugins/trezor.py b/plugins/trezor.py @@ -214,16 +214,17 @@ class TrezorWallet(NewWallet): pass def decrypt_message(self, pubkey, message, password): - address = public_key_to_bc_address(pubkey.decode('hex')) - address_path = self.address_id(address) - address_n = self.get_client().expand_path(address_path) - try: - decrypted_msg = self.get_client().decrypt_message(address_n, b64decode(message)) - except Exception, e: - give_error(e) - finally: - twd.emit(SIGNAL('trezor_done')) - return str(decrypted_msg) + raise BaseException( _('Decrypt method is not implemented in Trezor') ) + #address = public_key_to_bc_address(pubkey.decode('hex')) + #address_path = self.address_id(address) + #address_n = self.get_client().expand_path(address_path) + #try: + # decrypted_msg = self.get_client().decrypt_message(address_n, b64decode(message)) + #except Exception, e: + # give_error(e) + #finally: + # twd.emit(SIGNAL('trezor_done')) + #return str(decrypted_msg) def sign_message(self, address, message, password): if not self.check_proper_device():