tFix trezor restore - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 669cf74789fc04aaaa5dbea481e0d23e9a41bfd1 DIR parent 7372e0e082e2311c6de90eaaf1c3b0a436bb12d0 HTML Author: Neil Booth <kyuupichan@gmail.com> Date: Sun, 27 Dec 2015 15:38:52 +0900 Fix trezor restore Broken by my recent changes Diffstat: M lib/wallet.py | 5 +++-- M plugins/trezor/qt_generic.py | 19 +++++-------------- 2 files changed, 8 insertions(+), 16 deletions(-) --- DIR diff --git a/lib/wallet.py b/lib/wallet.py t@@ -26,6 +26,7 @@ import json import copy from functools import partial from struct import pack +from unicodedata import normalize from i18n import _ from util import NotEnoughFunds, PrintError, profiler t@@ -1764,8 +1765,8 @@ class BIP32_Hardware_Wallet(BIP32_HD_Wallet): # trezor uses bip39 import pbkdf2, hashlib, hmac PBKDF2_ROUNDS = 2048 - mnemonic = unicodedata.normalize('NFKD', ' '.join(mnemonic.split())) - passphrase = unicodedata.normalize('NFKD', passphrase) + mnemonic = normalize('NFKD', ' '.join(mnemonic.split())) + passphrase = normalize('NFKD', passphrase) return pbkdf2.PBKDF2(mnemonic, 'mnemonic' + passphrase, iterations = PBKDF2_ROUNDS, macmodule = hmac, digestmodule = hashlib.sha512).read(64) DIR diff --git a/plugins/trezor/qt_generic.py b/plugins/trezor/qt_generic.py t@@ -6,7 +6,6 @@ from PyQt4.Qt import QGridLayout, QInputDialog, QPushButton from PyQt4.Qt import QVBoxLayout, QLabel, SIGNAL from trezor import TrezorPlugin from electrum_gui.qt.main_window import ElectrumWindow, StatusBarButton -from electrum_gui.qt.installwizard import InstallWizard from electrum_gui.qt.password_dialog import PasswordDialog from electrum_gui.qt.util import * t@@ -62,19 +61,11 @@ class QtHandler: self.done.set() def passphrase_dialog(self, msg): - if type(self.win) is ElectrumWindow: - msg = _("Please enter your %s passphrase") % self.device - passphrase = self.win.password_dialog(msg) - else: - assert type(self.win) is InstallWizard - d = PasswordDialog(self.win, None, None, msg, False) - confirmed, p, passphrase = d.run() - - if passphrase is None: - self.win.show_critical(_("Passphrase request canceled")) - else: - passphrase = normalize('NFKD', unicode(passphrase)) - self.passphrase = passphrase + d = PasswordDialog(self.win, None, None, msg, False) + confirmed, p, phrase = d.run() + if confirmed: + phrase = normalize('NFKD', unicode(phrase or '')) + self.passphrase = phrase self.done.set() def message_dialog(self, msg, cancel_callback):